Scenario:
While creating transaction records via suitescript, In some case when setting which the price/amount value field, following error raise: “you have entered an Invalid Field Value 1,191.78 for the following field: rate”, This is because the price contain a comma ” , ” in the value. For other three digit values, script will work fine.
To rectify this error following code can be used while setting the value, where priceData holds th amount value need to be set in the field.
parseFloat(priceData.replace(/,/g, ”))
sample code:
rec.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'amount',
value: parseFloat(amountValue.replace(/,/g, ''))
});