When sending a number to the netsuite rest api, ho...
# ask-stanley-ai
v
When sending a number to the netsuite rest api, how do I ensure the api recognizes that a value is a number and not a string?
c
AI generated answer (using internal Slack threads):
When sending a number to the NetSuite REST API, you should ensure that the API recognizes the value as a number and not a string by sending the value as an integer and not a float/decimal. However, it's important to note that NetSuite can be inconsistent with whether it returns/expects strings, numbers, or booleans. For instance, if you're setting the value of a Customer’s Account Number field as a whole number, and NetSuite is adding a decimal place, you might want to try sending the value as a string instead of a number. This could prevent NetSuite from formatting the number and adding a decimal place. Here's an example of how you might do this:
Copy code
javascript
var customerRecord = record.create({type: record.Type.CUSTOMER});
customerRecord.setValue({
    fieldId: 'accountnumber',
    value: '27152' // send as a string
});
Remember, this is just a workaround and might not work for all fields or scenarios. Always test your code thoroughly to ensure it behaves as expected. ****** 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.834543049
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.83379817
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.827788889
Please provide your feedback on this answer.