web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Using Page Webservice to Update Records in NAV16

(0) ShareShare
ReportReport
Posted on by 60

Hello everybody,

I created a table and a page and exposed it as a webservice in NAV2016. 

Creating, reading and deleting works fine through webservice calls, but I'm having problems getting update method to work. The values never seem to change, although NAV doesn't complain.

The update method requires a Key value as a parameter. To get this after object creation, I use ReadMultiple and assume that the last entry in list is the recently created item. Is there a better way to do it?

Also the key looks broken:

<Key>12;XMMAAACHAgU=7;10432370;</Key>

The webservice gets called with these parameters (i want to update Comment field):

array(1) {
["Picklist"]=>
array(2) {
["Key"]=>
string(26) "12;XMMAAACHBQU=7;10436910;"
["Comment"]=>
string(4) "1234"
}
}

That's the response:
{"response":{"Picklist":{"Key":"12;XMMAAACHBQU=7;10436910;","Code":"L-6","Description":"desc","Location_Code":"location"}}}

Notice that the field i want to update is missing - why?

When i check the page in RTC, the field is not updated.

Can you give me a hint?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    DynamicsDevBeginner Profile Picture
    60 on at
    RE: Using Page Webservice to Update Records in NAV16

    I've managed to solve my issue. Problem was an outdated WSDL file. Now everything works as excepted.

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Using Page Webservice to Update Records in NAV16

    Hello,

    In order to read, you have two options:

    - The "Key" as you want to do (this is the hard way because you can not guess what is the key ;) ),

    - Or more simple, use the primary key fields. This is the way I had in mind when I gave you the example with Customer table (The primary key is "No." ==> CustomerProxy.READ("10000"))

    P.S: If your table has more than one fields as primary key ,Sales Header for example, then you should use something like this:

    SalesHeader = SalesHeaderProxy.READ("Document Type", "No.")

    where "Document Type" is an integer = Quote,Order,Invoice,Credit Memo,Blanket Order,Return Order
     ==> 0 for Quote

    ==> 1 for Order

    ==> 2 for Invoice ...

    "No." is the number of your Quote,Order,Invoice...

    I'll let you try to stew all that ;)

  • DynamicsDevBeginner Profile Picture
    60 on at
    RE: Using Page Webservice to Update Records in NAV16

    Hello Suresh Kulla,

    thanks for your help, but I am using ajax to send the data to NAV, so the tutorial does not help me.

  • DynamicsDevBeginner Profile Picture
    60 on at
    RE: Using Page Webservice to Update Records in NAV16

    Hello,

    thanks for your answer.

    To perform a read operation, the web service needs the key of the object that was created. But how should I get it?

    I've added the field in the page, and it is just included in the web service response if it contains a value.

  • Suggested answer
    Suresh Kulla Profile Picture
    49,257 Super User 2025 Season 2 on at
    RE: Using Page Webservice to Update Records in NAV16

    Check this link which shows how to update a field

    msdn.microsoft.com/.../dd355316(v=nav.90).aspx

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Using Page Webservice to Update Records in NAV16

    Hi,

    You can "read" then "update".

    For example, if your table is Customer:

    Cust = CustomerProxy.READ("10000") --> Cust.FIELD = NewValue --> CustomerProxy.UPDATE(Cust.Key)

    In order to see your field in XML, you should add it in the page as column.

    I hope these hints will help you :)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans