Question Status

Suggested Answer
Aetona asked a question on 26 Apr 2012 4:06 AM

I can't update sales order by AIF using the following XML file.
Message says that "Cannot update record - the record does not exist.".
And this message is @SYS112449.
--------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
 <Envelope xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/Message">
 <Header>
  <MessageId />
  <SourceEndpointUser>contoso\Administrator</SourceEndpointUser>
  <SourceEndpoint>FileAdapter</SourceEndpoint>
  <DestinationEndpoint>LocalEP</DestinationEndpoint>
  <Action>http://schemas.microsoft.com/dynamics/2008/01/services/SalesOrderService/update</Action>
  <ConversationId />
  </Header>
 <Body>
     <MessageParts xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/Message">
     <EntityKeyList xmlns="http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKeyList">
         <EntityKey xmlns="http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKey">
             <KeyData>
                 <KeyField>
                      <Field>SalesId</Field>
                      <Value>SO-101253</Value>
                  </KeyField>
              </KeyData>
          </EntityKey>
      </EntityKeyList>
  <SalesOrder xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/SalesOrder">
      <SalesTable class="entity" action="update">
         <_DocumentHash>5c6d97a737419b29e23c69a70765fba0</_DocumentHash>
         <DeliveryDate>2012-04-29</DeliveryDate>
         <PurchOrderFormNum>1</PurchOrderFormNum>
        <SalesLine class="entity" action="update">
             <ItemId>1001</ItemId >
             <SalesQty>5</SalesQty>
             <SalesUnit>ea</SalesUnit>
        </SalesLine>     
      </SalesTable>
    </SalesOrder>
  </MessageParts>
  </Body>
  </Envelope>
-----------------------------------------------------------------------------
Although the document read by AIF is as following.
------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<Envelope xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/Message">
 <Header><MessageId>{E6D579B1-1C3F-40D5-858B-255CB17F83A4}</MessageId>
 <SourceEndpoint>LocalEP</SourceEndpoint><DestinationEndpoint>FileAdapter</DestinationEndpoint>
 <Action>http://schemas.microsoft.com/dynamics/2008/01/services/SalesOrderService/read</Action>
 <RequestMessageId>{A5BF71EF-100F-4DA2-B342-A65DD51C08C3}</RequestMessageId>
 </Header>
  <Body><MessageParts xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/Message">
   <SalesOrder xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/SalesOrder">
    <SalesTable class="entity">
     <_DocumentHash>5c6d97a737419b29e23c69a70765fba0</_DocumentHash>
     <DeliveryDate>2012-04-27</DeliveryDate><PurchOrderFormNum />
     <SalesLine class="entity">
      <ItemId>1003</ItemId><SalesQty>1.00</SalesQty><SalesUnit>ea</SalesUnit>
     </SalesLine>
     <SalesLine class="entity">
      <ItemId>1001</ItemId><SalesQty>1.00</SalesQty><SalesUnit>ea</SalesUnit>
     </SalesLine>
    </SalesTable>
   </SalesOrder>
  </MessageParts>
 </Body>
</Envelope>
------------------------------------------------------------------------------
Therefore I can't imagine the reason of the above error . This error ocuurs in the deserializeSubEntitiy method of the AxdBase class.Actual line of error occurs at 61 and this caused by the empty result of the following command.
I checked the _dataSourceName then found that it is "SalesLine".

------------------------------------------------------------------------------
// Find the corresponding existing record
        entityEntry = this.findEntityOnCurLevel(_dataSourceName,_axInternalBase);
------------------------------------------------------------------------------

Does anyone have any idea of solving this problem.

Reply
Suggested Answer
Robert Sammut responded on 4 May 2012 12:26 AM

Hi,

I found the solution by adding the RecId and RecVersion in the child elements. Read this page for more details: blogs.msdn.com/.../rec-fields-required-in-aif-partial-update.aspx.

Reply
Suggested Answer
Aetona responded on 16 May 2012 11:10 PM

Hi,

Thanks.

I tried by using RecID and RecVersion then the above error disapered.

Still I couldn't update with error message "Update has been cancelled".

Reply
Robert Sammut responded on 3 May 2012 8:39 AM

Hi there,

Did you find a solution to your problem?

We are having the exact same problem to update the vendtable and it's corresponding address. When we remove the address element the vendor (VendTable) is updated without errors. However with the Address element we get the "Cannot update record - the record does not exist." error. Is it a problem of linking the address (child node) with the vendor (parent node)?

Reply
Aetona responded on 3 May 2012 5:33 PM

Hi,

I couldn't find a solution not yet.

My case is SalesOrder(parent) and SalesLine(child) then this is similar as your case.

Reply
Suggested Answer
Robert Sammut responded on 4 May 2012 12:26 AM

Hi,

I found the solution by adding the RecId and RecVersion in the child elements. Read this page for more details: blogs.msdn.com/.../rec-fields-required-in-aif-partial-update.aspx.

Reply
Suggested Answer
Aetona responded on 16 May 2012 11:10 PM

Hi,

Thanks.

I tried by using RecID and RecVersion then the above error disapered.

Still I couldn't update with error message "Update has been cancelled".

Reply
Mike N Ike responded on 28 Jun 2013 10:01 AM

I'm getting the same issue with a custom service.  I'm trying to do what this describes:

technet.microsoft.com/.../hh582243.aspx

Where you are supposedly able to do Create, Update, and Delete operations on child records but, it doesn't seem to work as advertised.  I've tried the RecId and RecVersion but, that doesn't work.

Reply
Naushad Kakarla responded on 5 May 2014 7:48 AM

Check if Recid and RecVersion are enabled on Update actionId's data policy and also the order of elements in the xml for the child records.

Reply