When using `record.submitFields` We see an error p...
# ask-stanley-ai
l
When using
record.submitFields
We see an error passing a verified number value to a decimal number. Should we be submitting it as a string? EG
Copy code
record.submitFields({
  type: 'customrecord_custom_type',
  id: 123456,
  values: {
    'custrecord_decimal_field': 123
  }
})
// throws an Error
// "name": "INVALID_FLD_VALUE",
// "message": "You have entered an Invalid Field Value ERROR: Invalid Expression for the following field: custrecord_decimal_field",
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems that the error you're encountering when using
record.submitFields
and passing a number value to a decimal number field might be due to the way NetSuite handles number values. In JavaScript, numbers can be represented in different ways, and when you're passing a number value to a decimal number field, it's possible that NetSuite is interpreting the number in a way that's causing the error. One solution that was suggested in the conversations is to convert the number to a string before passing it to
record.submitFields
. This can be done using the
String()
function in JavaScript. Here's an example of how you can do this:
Copy code
javascript
record.submitFields({
  type: 'customrecord_custom_type',
  id: 123456,
  values: {
    'custrecord_decimal_field': String(123)
  }
})
This should prevent the error from occurring, as the number is now being passed as a string, which NetSuite should be able to handle correctly. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.857641399
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.851496458
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.847126484
Please provide your feedback on this answer.