Getting this error `,"name":"INVALID_FLD_VALUE","m...
# suitescript
g
Getting this error
,"name":"INVALID_FLD_VALUE","message":"You have entered an Invalid Field Value -1 for the following field: price",
From this Code:
Copy code
salesOrder.selectNewLine({
            //add a line to a sublist
            sublistId: 'item' //specify which sublist
        })

        salesOrder.setCurrentSublistValue({
            //set item field
            sublistId: 'item',
            fieldId: 'item',
            value: internalIdProduct
        })
        salesOrder.setCurrentSublistValue({
            sublistId: 'item',
            fieldId: 'quantity',
            value: qtyOrdered
        })
        salesOrder.setCurrentSublistValue({
            sublistId: 'item',
            fieldId: 'price',
            value: -1 //sets to custom price level
        })
        salesOrder.setCurrentSublistValue({
            sublistId: 'item',
            fieldId: 'rate', //'amount',
            value: price
        })
        salesOrder.setCurrentSublistValue({
            sublistId: 'item',
            fieldId: 'amount',
            value: lineTotal
        })
        //repeat above pattern to set the rest of the line fields

        salesOrder.commitLine({
            //writes the line entry into the loaded record
            sublistId: 'item'
        })
anyone have any suggestions please??????
e
I think the field is
pricelevel
not
price
g
no, the field price changes pricelevel... I had it in a function... when I moved it out it worked... must be some syntax issue that is causing it somewhere along the line
thanks
e
pricelevel needs to be set to -1 for a custom price
d
only thought would be that
item
didn't set properly. You'd see this error if item didn't set, as you can't select "Custom" price level with no item
g
yes, that is what happened, not sure what was wrong wiht my function - ijust moved it back and it works
thanks