The createdFrom field on NetSuite Invoice is not populating when using SOAP Web Services via Workato

1.1k views Asked by At

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.

3

There are 3 answers

1
Anuradha Sinha On

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!

   

 <soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:messages="urn:messages_2020_1.platform.webservices.netsuite.com" xmlns:accountingLists="urn:accounting_2020_1.lists.webservices.netsuite.com" xmlns:employeesLists="urn:employees_2020_1.lists.webservices.netsuite.com" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:employeesTransactionsTypes="urn:types.employees_2020_1.transactions.webservices.netsuite.com" xmlns:demandplanningTransactions="urn:demandplanning_2020_1.transactions.webservices.netsuite.com" xmlns:common="urn:common_2020_1.platform.webservices.netsuite.com" xmlns:commonTypes="urn:types.common_2020_1.platform.webservices.netsuite.com" xmlns:accountingListsTypes="urn:types.accounting_2020_1.lists.webservices.netsuite.com" xmlns:customizationSetup="urn:customization_2020_1.setup.webservices.netsuite.com" xmlns:inventoryTransactionsTypes="urn:types.inventory_2020_1.transactions.webservices.netsuite.com" xmlns:supportLists="urn:support_2020_1.lists.webservices.netsuite.com" xmlns:filecabinetDocuments="urn:filecabinet_2020_1.documents.webservices.netsuite.com" xmlns:bankTransactionsTypes="urn:types.bank_2020_1.transactions.webservices.netsuite.com" xmlns:communicationGeneralTypes="urn:types.communication_2020_1.general.webservices.netsuite.com" xmlns:customizationSetupTypes="urn:types.customization_2020_1.setup.webservices.netsuite.com" xmlns:supplychainListsTypes="urn:types.supplychain_2020_1.lists.webservices.netsuite.com" xmlns:core="urn:core_2020_1.platform.webservices.netsuite.com" xmlns:coreTypes="urn:types.core_2020_1.platform.webservices.netsuite.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:supplychainLists="urn:supplychain_2020_1.lists.webservices.netsuite.com" xmlns:demandplanningTransactionsTypes="urn:types.demandplanning_2020_1.transactions.webservices.netsuite.com" xmlns:websiteLists="urn:website_2020_1.lists.webservices.netsuite.com" xmlns:salesTransactions="urn:sales_2020_1.transactions.webservices.netsuite.com" xmlns:salesTransactionsTypes="urn:types.sales_2020_1.transactions.webservices.netsuite.com" xmlns:relationshipsLists="urn:relationships_2020_1.lists.webservices.netsuite.com" xmlns:inventoryTransactions="urn:inventory_2020_1.transactions.webservices.netsuite.com" xmlns:employeesListsTypes="urn:types.employees_2020_1.lists.webservices.netsuite.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:customersTransactions="urn:customers_2020_1.transactions.webservices.netsuite.com" xmlns:schedulingActivitiesTypes="urn:types.scheduling_2020_1.activities.webservices.netsuite.com" xmlns:financialTransactions="urn:financial_2020_1.transactions.webservices.netsuite.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:relationshipsListsTypes="urn:types.relationships_2020_1.lists.webservices.netsuite.com" xmlns:employeesTransactions="urn:employees_2020_1.transactions.webservices.netsuite.com" xmlns:faults="urn:faults_2020_1.platform.webservices.netsuite.com" xmlns:marketingListsTypes="urn:types.marketing_2020_1.lists.webservices.netsuite.com" xmlns:communicationGeneral="urn:communication_2020_1.general.webservices.netsuite.com" xmlns:faultsTypes="urn:types.faults_2020_1.platform.webservices.netsuite.com" xmlns:supportListsTypes="urn:types.support_2020_1.lists.webservices.netsuite.com" xmlns:websiteListsTypes="urn:types.website_2020_1.lists.webservices.netsuite.com" xmlns:purchasesTransactions="urn:purchases_2020_1.transactions.webservices.netsuite.com" xmlns:financialTransactionsTypes="urn:types.financial_2020_1.transactions.webservices.netsuite.com" xmlns:schedulingActivities="urn:scheduling_2020_1.activities.webservices.netsuite.com" xmlns:bankTransactions="urn:bank_2020_1.transactions.webservices.netsuite.com" xmlns:marketingLists="urn:marketing_2020_1.lists.webservices.netsuite.com" xmlns:customersTransactionsTypes="urn:types.customers_2020_1.transactions.webservices.netsuite.com" xmlns:purchasesTransactionsTypes="urn:types.purchases_2020_1.transactions.webservices.netsuite.com" xmlns:generalTransactions="urn:general_2020_1.transactions.webservices.netsuite.com" xmlns:filecabinetDocumentsTypes="urn:types.filecabinet_2020_1.documents.webservices.netsuite.com">
    <soap:Header>
        <urn:tokenPassport xmlns:urn="urn:messages_2020_1.platform.webservices.netsuite.com">
          <ns8:account xmlns:ns8="urn:core_2020_1.platform.webservices.netsuite.com">XXX</ns8:account>
          <ns8:consumerKey xmlns:ns8="urn:core_2020_1.platform.webservices.netsuite.com">XXX</ns8:consumerKey>
          <ns8:token xmlns:ns8="urn:core_2020_1.platform.webservices.netsuite.com">XXX</ns8:token>
          <ns8:nonce xmlns:ns8="urn:core_2020_1.platform.webservices.netsuite.com">XXX</ns8:nonce>
          <ns8:timestamp xmlns:ns8="urn:core_2020_1.platform.webservices.netsuite.com">XXX</ns8:timestamp>
          <ns8:signature xmlns:ns8="urn:core_2020_1.platform.webservices.netsuite.com" algorithm="HMAC_SHA256">XXX</ns8:signature>
        </urn:tokenPassport>
       <preferences xmlns="urn:messages_2020_1.platform.webservices.netsuite.com"/>
       </soap:Header>
    <soap:Body>
        <add>
          <record xmlns:salesTransactions="urn:sales_2020_1.transactions.webservices.netsuite.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="salesTransactions:Invoice">
            <itemList>
              <item xsi:type="salesTransactions:InvoiceItem">
                <orderLine xsi:type="salesTransactions:long">1</orderLine>
                <quantity xsi:type="salesTransactions:double">1</quantity>
                <rate xsi:type="salesTransactions:string">30000</rate>
                <description xsi:type="salesTransactions:string">Annuity test</description>
              </item>
            </itemList>
            <tranDate xsi:type="salesTransactions:dateTime">2020-09-09T00:00:00.000</tranDate>
            <createdFrom xmlns:core="urn:core_2020_1.platform.webservices.netsuite.com" xsi:type="core:RecordRef" internalId="33202933"/>
            <externalId xmlns:core="urn:core_2020_1.platform.webservices.netsuite.com" xsi:type="core:RecordRef">INV000089099</externalId>
          </record>
        </add>
      </soap:Body>
     </soap:Envelope>

1
Martha On

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.

0
Sanne On

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>