I am using Workato for my Salesforce to NetSuite integration and everything works perfectly with the exception of populating the createdFrom field on the Invoice record. Has anyone been successful in linking the NetSuite Invoice to its associated Sales Order using Web Services? This is critical as the linkage ensures that Revenue Arrangements are not duplicated in NetSuite.
The createdFrom field on NetSuite Invoice is not populating when using SOAP Web Services via Workato
1.1k views Asked by George McLaughlin AtThere are 3 answers
I do not have first hand experience with SOAP Web Services but have seen via SuiteScript 2.x that one cannot simply create the record and try to fill in the createdFrom field. You must rather "transform" a Sales Order into an Invoice for example. The "transformation" is what links the two. Looks like for SOAP the operation is named "initialize / initializeList". The SOAP web services initialize operation emulates the UI workflow by prepopulating fields on transaction line items with values from a related record. Reference Suite Answer 10771 for more information. Suite Answer 91358 also has some sample code.
I was able to create an invoice in NetSuite and link it to the sales order. To make the link with the sales order, you'll need to mention the link both on sales order level (via the createdFrom field) as on item level (via the orderLine field).
A request will look like this:
<soap:Body>
<ns1:upsert xmlns:ns1="urn:messages_2020_1.platform.webservices.netsuite.com">
<ns0:record xsi:type="ns0:Invoice" ns0:externalId="fillinexternalidhere" xmlns:ns0="urn:sales_2020_1.transactions.webservices.netsuite.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns1:itemList xmlns:ns1="urn:sales_2020_1.transactions.webservices.netsuite.com">
<ns1:item>
<ns1:item internalId="1"/>
<ns1:amount>1000</ns1:amount>
<ns1:quantity>1</ns1:quantity>
<ns1:orderLine>1</ns1:orderLine>
</ns1:item>
</ns1:itemList>
<ns1:tranDate xmlns:ns1="urn:sales_2020_1.transactions.webservices.netsuite.com">2023-05-23T00:00:00Z</ns1:tranDate>
<ns1:createdFrom internalId="1000" xmlns:ns1="urn:sales_2020_1.transactions.webservices.netsuite.com"></ns1:createdFrom>
</ns0:record>
</ns1:upsert>
</soap:Body>
yes I have created invoices from Sales Order using SOAP Webservices. I am using minimum number of required fields to create the invoice. Here is the endpoint URL that I used : https://(insert your account Id here).suitetalk.api.netsuite.com/services/NetSuitePort_2020_1
Note 1: You need to make sure that the version is consistent through out your SOAP request (in my case it's 2020_1)
Note 2: You can see that I am passing createdFrom tag as second last tag and I am passing Sales order's internal ID there. That means that invoice is being generated from that particular sales order and it carries over rest of the fields from sales order
Note 3: I am passing externalid of the invoice at the end which will the unique id of this newly created invoice across different systems
Please let me know how this goes!