Incoming http Request Modifying NAV Table [NAV 2009 R2]

HCAndersenHCAndersen Member Posts: 2
Hi there,
I am designing a code unit and a xmlport in order to modify NAV contact table record from an external .net http-request. (Avoiding physical xml-files in the process is preferred). However the method below is only good for inserting new records into the NAV table. Modifying is also required.

A XMLport has the following layout based on the contact table:
9pnv0r21ilet.png

A code unit has the xmlport as input parameter and the following statement only:
8mt9p9qoiltz.png

A simplified request from a test client has the following xml-design (based on the published NAV codeunit's wsdl):
<CRMImporttest xmlns="urn:microsoft-dynamics-schemas/codeunit/WSUpdateNAVContact">
      <cRMImportxml>
        <Contact xmlns="urn:microsoft-dynamics-nav/xmlports/x50009">
          <No>KT1234569</No>
          <Name>hello</Name>
        </Contact>
      </cRMImportxml>
    <CRMImporttest />
When the test client is executed the record is inserted perfectly into the NAV table.
z8anauoxdhrt.png

But NAV returns error if the record already exist and the record has to be modified instead. Any ideas how tweak the codeunit to modify existing records using the method described above?
Thanks in advance!

Comments

  • gbierkensgbierkens Member Posts: 49
    edited 2016-03-01
    You could use a temp table in your xml-port.
    Then insert the contact using a global record and ofcourse if the record allready exists you can modify it.
  • m_bergerm_berger Member Posts: 7
    You should be able to change this behaviour using the "AutoSave", "AutoReplace" and "AutoUpdate" properties of the "Contact" element.
  • HCAndersenHCAndersen Member Posts: 2
    Thanks ! I'll attempt to use the temporary table.
  • gbierkensgbierkens Member Posts: 49
    edited 2016-03-23
    m_berger wrote: »
    You should be able to change this behaviour using the "AutoSave", "AutoReplace" and "AutoUpdate" properties of the "Contact" element.

    The functions AutoSave, AutoReplace and AutoUpdate are not available in NAV 2009 R2.
  • devdronedevdrone Member Posts: 14
    Temp table is the solution
Sign In or Register to comment.