<operation name="OpdaterVogn"> <operation soapAction="urn:microsoft-dynamics-schemas/codeunit/BMG:OpdaterVogn" style="document"/> <input name="OpdaterVogn"> <body use="literal"/> </input> <output name="OpdaterVogn_Result"> <body use="literal"/> </output> </operation>afaik this is my method i need to use, to update the record in NAV. i need to update a "Vogn", and in my codeunit i get the following "class" i need to update with.
<schema elementFormDefault="qualified" targetNamespace="urn:microsoft-dynamics-nav/xmlports/x78001"> <complexType name="VognType"> <sequence> <element minOccurs="1" maxOccurs="1" name="Kode" type="string"/> <element minOccurs="1" maxOccurs="1" name="RegNr" type="string"/> <element minOccurs="1" maxOccurs="1" name="Beskrivelse" type="string"/> <element minOccurs="1" maxOccurs="1" default="false" name="Spaerret" type="boolean"/> </sequence> </complexType> <complexType name="Vogn" mixed="true"> <sequence> <element minOccurs="1" maxOccurs="unbounded" name="Vogn" type="tns:VognType"/> </sequence> </complexType><element name="Vogn" type="tns:Vogn"/> </schema>
Vogn vogneNy = new Vogn(); VognType vognNy = new VognType(); ws.SendVogn("BMG 2013", false, ref vogneNy); vogneNy.Vogn1[0].Beskrivelse = "lol"; ws.OpdaterVogn("BMG 2013", vogneNy);i get the following error: The Vogn already exists. Identification fields and values: Kode='FF1D57CC0
Answers
i try and add the data to a list and thereafter send that to NAV
new Error: {"The Element <Kode> is expected by Min Occurs value: Once. Element received: <>."}
I personally dont really like the list approach because nav often has its difficulties with it in my experience.
Frankly, there seems to be something wrong with the Codeunit.
Best of Luck
Wisa