Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 175888

Sales order creation from XML file with DocuRef - Field Type must be filled in

$
0
0

Hi All,

I have been facing an issue while creating a sales order from an XML file. I have provided the TypeId element tag in DocuRefHeader entity but its still complaining the value must be provided.

XML I am importing in AX

 <?xml version="1.0" encoding="utf-8" ?>

<SalesOrder xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/SalesOrder">

<SalesTable class="entity">

  <CustAccount>C000002</CustAccount>

  <DeliveryDate>2011-10-11</DeliveryDate>

  <ReceiptDateRequested>2011-11-11</ReceiptDateRequested>

  <PurchOrderFormNum>ABC-98654</PurchOrderFormNum>

  <InventLocationId>EMU</InventLocationId>

  <DeliveryName>Delivery name 465</DeliveryName>

<TableDlvAddr class="entity"> 

  <City>southbank</City>

  <CountryRegionId>AUS</CountryRegionId>

  <LocationName>delivery address</LocationName>

  <State>VIC</State>

  <Street>13075 MANCHESTER RD STE</Street> 

  <ZipCode>3006</ZipCode>

</TableDlvAddr>

<SalesLine class="entity">

<ItemId>CANO</ItemId>

<SalesQty>20</SalesQty>

<SalesPrice>82.25</SalesPrice>

<SalesUnit>ltr</SalesUnit>

  </SalesLine>

<DocuRefHeader class="entity">

            <TypeId>Note</TypeId>

            <Notes>Carriage Extra at Cost</Notes>

            <Restriction>External</Restriction>

</DocuRefHeader>

</SalesTable>

</SalesOrder>

 

Job to test above XML

 

staticvoid JobImportXml(Args _args)

{

    //feed the xml that was modified after exporting through exportxml job

    XmlDocument xml = XmlDocument::newFile(@'C:\temp\SORequest.xml');

    AxdSalesOrder salesOrder;

 

    try

    {

        salesOrder = new AxdSalesOrder();

        salesOrder.create(xml.xml(),  new AifEndPointActionPolicyInfo(), new AifConstraintList());

    }

    catch

    {

        throw error('Error in document service');

    }

    info(strFmt('Sales order created'));

}

 

Getting this error

 


Viewing all articles
Browse latest Browse all 175888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>