Friday, July 12, 2019

Avoid getting "Invalid salesorder reference key <salesorder id> for customer <customer id>" when adding Customer Deposit via Web Services.

Submitting a customer deposit via Web Services however it throws an error "Invalid salesorder reference key <salesorder id> for customer <customer id>".

Sample Scenario:
1. Sales Order with internal id 35499 is already billed.
2. Create Customer Deposit by invoking the following web services request:
      <platformMsgs:record xsi:type="tranCust:CustomerDeposit">
        <tranCust:customer internalId="16128"/>
        <tranCust:salesOrder internalId="35499"/>

Actual Result:
    <addResponse xmlns="">
        <platformCore:status isSuccess="false" xmlns:platformCore="">
          <platformCore:statusDetail type="ERROR">
            <platformCore:message>Invalid salesorder reference key 35499 for customer 16128.</platformCore:message>
Expected Result: Customer Deposit should be created successfully.
When checking the sales order  35499 (this is just a sample order) and it shows that this order is already billed so when I try to create deposit for this order then it  will throw invalid reference key error.  If you check in the UI, "Create Deposit" is also not showing up in the form.

This is also related to SuiteAnswers 21653 which states the following:

If the Create Deposit Button is not visible on the Sales Order Record, the reason must be one of the following:
1.   The status of the Sales Order is Cancelled, Closed or Billed.
2.   The Sales Order Form is of the Standard Sales Order Type and the Payment Method field is not blank.
3.   The Sales Order Form is of the Cash Sale Type.
4.   The Sales Order Form is customized to not show the Create Deposit Button.


1 comment: