William W
William W

Reputation: 1806

NetSuite Web Service Sales Order Error - Invalid orderstatus reference key B

I've recently run into the following error when connecting to a new NetSuite instance and trying to create a SalesOrder:

<platformCore:statusDetail type="ERROR">
<platformCore:code>INVALID_KEY_OR_REF</platformCore:code>
<platformCore:message>Invalid orderstatus reference key B.</platformCore:message>

The reason I'm having trouble with this error is because:

  1. I'm not sending B as the orderstatus, I'm sending _pendingFulfillment
  2. This same call format works against a different NetSuite account

Does anyone have any clue what could be causing this error? Something on my end, or some configuration within the NetSuite account?

I'm using NetSuite's PHP library, but the raw XML posted looks something like this:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:platformMsgs="urn:messages_2018_2.platform.webservices.netsuite.com" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:platformCore="urn:core_2018_2.platform.webservices.netsuite.com" xmlns:platformCommon="urn:common_2018_2.platform.webservices.netsuite.com" xmlns:listRel="urn:relationships_2018_2.lists.webservices.netsuite.com" xmlns:tranSales="urn:sales_2018_2.transactions.webservices.netsuite.com" xmlns:tranPurch="urn:purchases_2018_2.transactions.webservices.netsuite.com" xmlns:actSched="urn:scheduling_2018_2.activities.webservices.netsuite.com" xmlns:setupCustom="urn:customization_2018_2.setup.webservices.netsuite.com" xmlns:listAcct="urn:accounting_2018_2.lists.webservices.netsuite.com" xmlns:tranBank="urn:bank_2018_2.transactions.webservices.netsuite.com" xmlns:tranCust="urn:customers_2018_2.transactions.webservices.netsuite.com" xmlns:tranEmp="urn:employees_2018_2.transactions.webservices.netsuite.com" xmlns:tranInvt="urn:inventory_2018_2.transactions.webservices.netsuite.com" xmlns:listSupport="urn:support_2018_2.lists.webservices.netsuite.com" xmlns:tranGeneral="urn:general_2018_2.transactions.webservices.netsuite.com" xmlns:commGeneral="urn:communication_2018_2.general.webservices.netsuite.com" xmlns:listMkt="urn:marketing_2018_2.lists.webservices.netsuite.com" xmlns:listWebsite="urn:website_2018_2.lists.webservices.netsuite.com" xmlns:fileCabinet="urn:filecabinet_2018_2.documents.webservices.netsuite.com" xmlns:listEmp="urn:employees_2018_2.lists.webservices.netsuite.com">
<env:Header>
<platformMsgs:tokenPassport>
<platformCore:account>3537721</platformCore:account>
<platformCore:consumerKey>***REMOVED***</platformCore:consumerKey>
<platformCore:token>***REMOVED***</platformCore:token>
<platformCore:nonce>rWHjYyEwmMG7g9z4MkhC</platformCore:nonce>
<platformCore:timestamp>1595380696</platformCore:timestamp>
<platformCore:signature algorithm="HMAC-SHA256">***REMOVED***</platformCore:signature>
</platformMsgs:tokenPassport>
</env:Header>
<env:Body>
<platformMsgs:add>
<platformMsgs:record xsi:type="tranSales:SalesOrder">
<tranSales:orderStatus>_pendingFulfillment</tranSales:orderStatus>
<tranSales:otherRefNum/>
<tranSales:toBePrinted>false</tranSales:toBePrinted>
<tranSales:toBeEmailed>false</tranSales:toBeEmailed>
<tranSales:toBeFaxed>false</tranSales:toBeFaxed>
<tranSales:email>***REMOVED***</tranSales:email>
<tranSales:itemList>
<tranSales:item>
<tranSales:item internalId="67004" type="inventoryItem"/>
<tranSales:quantity>1</tranSales:quantity>
</tranSales:item>
</tranSales:itemList>
<tranSales:customForm internalId="100"/>
<tranSales:tranDate>2020-07-20T05:18:20+00:00</tranSales:tranDate>
<tranSales:salesEffectiveDate>2020-07-20T05:18:20+00:00</tranSales:salesEffectiveDate>
<tranSales:shipDate>2020-07-20T05:18:20+00:00</tranSales:shipDate>
<tranSales:entity internalId="644" type="customer"/>
<tranSales:currency internalId="1" type="currency"/>
<tranSales:terms internalId="2" type="term"/>
<tranSales:subsidiary internalId="1" type="subsidiary"/>
<tranSales:location internalId="10" type="location"/>
<tranSales:customFieldList>
<platformCore:customField xsi:type="platformCore:SelectCustomFieldRef" internalId="560" scriptId="custbody_bwt_availmons_so">
<platformCore:value internalId="11" typeId="175"/>
</platformCore:customField>
<platformCore:customField xsi:type="platformCore:StringCustomFieldRef" internalId="725" scriptId="custbody17">
<platformCore:value>185216_Nov</platformCore:value>
</platformCore:customField>
<platformCore:customField xsi:type="platformCore:MultiSelectCustomFieldRef" internalId="281" scriptId="custbody10">
<platformCore:value>yes</platformCore:value>
</platformCore:customField>
<platformCore:customField xsi:type="platformCore:DateCustomFieldRef" internalId="91" scriptId="custbody_del_due_date">
<platformCore:value>2020-07-20T05:18:20+00:00</platformCore:value>
</platformCore:customField>
<platformCore:customField xsi:type="platformCore:StringCustomFieldRef" internalId="24" scriptId="custbody5">
<platformCore:value/>
</platformCore:customField>
</tranSales:customFieldList>
</platformMsgs:record>
</platformMsgs:add>
</env:Body>
</env:Envelope>

Upvotes: 0

Views: 1415

Answers (1)

bknights
bknights

Reputation: 15447

I have had this issue on accounts where the default Sales Order status is Pending Fulfillment -- essentially you can't set it to what it already is. I'd guess it's because the order status is part of a state machine and there is no valid transition from Pending Fulfillment to Pending Fulfillment.

The default status is set up in your account under Accounting Preferences or you can get this with a script call referencing the DEFSALESORDSTATUS preference. I don't believe the preferences are exposed to SuiteTalk.

FWIW 'B' is the internal value of the Pending Fulfillment orderstatus. and 'SalesOrd:B' is the internal value that would be used on a scripted search for orders in Pending Fulfillment status.

Upvotes: 2

Related Questions