How to get approvalstatus below is not working in...
# ask-stanley-ai
v
How to get approvalstatus below is not working invoice.setValue({ fieldId: 'approvalstatus', value: 1 });
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems that you are trying to set the
approvalstatus
field of an invoice record in NetSuite using SuiteScript. However, it's important to note that setting a field value is not the same as clicking a button in the UI. There are things buttons can do that setting fields can't, and vice versa. In your case, the
approvalstatus
field might not be directly settable. It's possible that this field's value is controlled by the system based on other conditions or actions (like clicking a button in the UI). If you are trying to replicate the action of a button click in SuiteScript, you might want to look into the
N/action
module. However, please note that this module supports a limited set of actions. Here is an example of how you might use the
N/action
module:
Copy code
javascript
var action = action.load({
    id: 'customaction_my_custom_action'
});
action.execute();
In this example,
customaction_my_custom_action
would be the ID of the custom action you want to execute. Please replace it with the actual ID of the action you want to perform. ****** 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.85559088
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.846069396
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.843566895
Please provide your feedback on this answer.
a
If it lets you set it (subsequent getValue shows your new value in the field), but it goes back to the previous value when you save, there might be another script or workflow setting the value back to the old one during beforeSubmit (if it doesn't show up in System Notes) or on afterSubmit (if it does).
Actually it doesn't let me do it either but maybe for different reasons, since I get the following error: The approval status field should only be used when the approval routing preference is selected.
Have you made sure the field exists for Invoices in your NS account?
v
Yes i have this field on invoice