Question

Specifically in NAV 2013. When I look up a record using a Page webservice, I get a response something like the following:

<Soap:Envelope xmlns:Soap="http://schemas.xmlsoap.org/soap/envelope/">
    <Soap:Body>
        <ReadMultiple_Result xmlns="urn:microsoft-dynamics-schemas/page/[PAGENAME]">
            <ReadMultiple_Result>
                <[RECORDNAME]>
                    <Key>##;[KEYSTUFF KEYSTUFF KEYSTUFF];[OTHER KEYSTUFF];</Key>
                    <[OTHERFIELD]>[OTHERDATA]</[OTHERFIELD]>
                </[RECORDNAME]>
            </ReadMultiple_Result>
        </ReadMultiple_Result>
    </Soap:Body>
</Soap:Envelope>

... and then, if I want to interact with that record to do an Update or Delete through the webservice, I have to use the Key field to refer to it directly.

What I want to know is if I can expose an XMLPort through a Codeunit webservice, and still export that Key field directly, or if I'll have to do some separate lookup to add it to the export for each row? Or if it might just make more sense to expose this info as a page since I'm planning on interacting with the records?

Was it helpful?

Solution

In this question a guy states that

that at least part of the key is a Base64 encoded string of the columns that make up the primary key

so the first part of the key is some kind of salt or timestamp that is used to avoid overwriting record when updating through exposed page.

There is no function in Nav that allows to calculate web-service key for certain record and no way to use this key in C/AL to fetch record.

If your intention is to use exposed codeunit to both read and write you can use XML port with Direction property set to Both as the parameter of procedure to read and update record in certain table(s). Of course in that case you have to use all primary key fields in XML Port to identify record.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top