levimllr
levimllr

Reputation: 74

"Please enter a value for amount." when creating invoice with discount with custom price level outside the US

I'm attempting to create invoices via the SOAP web services. The add action is failing with the following message:

ERROR|USER_ERROR|Please enter a value for amount.

There is no amount property on the body of the invoice, just its line items. I checked every line item for the presence of an amount property, and they all had one. Eventually, I isolated the issue to the discount line items, as invoices without them were successfully being created. The discount line items are of the form:

<ns9:item xsi:type="ns9:InvoiceItem">
    <ns9:item xsi:type="ns1670:RecordRef" internalId="80608" xmlns:ns1670="urn:core_2019_1.platform.webservices.netsuite.com"/>
    <ns9:amount xsi:type="xsd:double">-6.3</ns9:amount>
    <ns9:quantity xsi:type="xsd:double">1.0</ns9:quantity>
    <ns9:price xsi:type="ns1671:RecordRef" internalId="-1" xmlns:ns1671="urn:core_2019_1.platform.webservices.netsuite.com"/>
    <ns9:location xsi:type="ns1672:RecordRef" internalId="118" xmlns:ns1672="urn:core_2019_1.platform.webservices.netsuite.com"/>
    <ns9:taxCode xsi:type="ns1673:RecordRef" internalId="63807" xmlns:ns1673="urn:core_2019_1.platform.webservices.netsuite.com">
        <ns1673:name xsi:type="xsd:string">AVALARA-VAT - (63807)</ns1673:name>
    </ns9:taxCode>
    <ns9:customFieldList xsi:type="ns1674:CustomFieldList" xmlns:ns1674="urn:core_2019_1.platform.webservices.netsuite.com">
        <ns1674:customField xsi:type="ns1674:StringCustomFieldRef" scriptId="custcol_sq_referenceid">
            <ns1674:value xsi:type="xsd:string">51962_discount</ns1674:value>
        </ns1674:customField>
    </ns9:customFieldList>
</ns9:item>

Some details about the discount line item (not sure if these are relevant):

2 things I've found are:

  1. This exact same discount line item has been in other successfully synced invoices, the only difference I've found being that the customer, location, and subsidiary associated with this invoice is in Great Britain, not the US.
  2. I'm can create this invoice by not specifying the price level as -1, and so have it be undefined.

I have 2 questions:

  1. Why does NetSuite not think I'm providing a value for the amount of this discount line item only on invoices created in the UK (or not in the US)?
  2. Is it good practice to have discount line items have the custom price level (-1) or an undefined price level (or does it matter)?

Thanks for taking the time to think about this problem and let me know if you need any more details.

Upvotes: 0

Views: 907

Answers (1)

levimllr
levimllr

Reputation: 74

This error is a bit of a red herring. While it's not clear what's causing it, price levels are intended to be used with items that are sold. Discount items are not sold items, and so it doesn't make NetSuite since to assign them a price level.

Removing the price level from discount line items so it is undefined is valid and prevents the error from being thrown.

Upvotes: 0

Related Questions