I used nlapiSubmitField() on an advanced intercomp...
# ask-stanley-ai
a
I used nlapiSubmitField() on an advanced intercompany journal entry's Status field and its Approval Status field, but the changes did not save. Both fields still have their original values. How do I make the changes stick?
c
AI generated answer (using internal Slack threads):
****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** The
nlapiSubmitField()
function is not capable of changing the status of a record. This function is used to set the value of one or more fields on a record. However, it does not have the ability to change the status of a record, such as an advanced intercompany journal entry's Status field or its Approval Status field. In order to change the status of a record, you would need to load the record, set the status field, and then save the record. Here is a sample code snippet:
Copy code
javascript
var record = nlapiLoadRecord('recordType', 'recordId');
record.setFieldValue('status', 'newStatus');
nlapiSubmitRecord(record);
Please replace 'recordType', 'recordId', and 'newStatus' with your actual record type, record id, and the new status you want to set. Also, keep in mind that the status field's internal id might be different, like 'orderstatus' for sales orders. You need to use the correct internal id for the status field of the record type you are working with. Remember, changing the status of a record might trigger workflows or scripts attached to the record. Make sure your scripts and workflows handle this correctly.
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.827636838
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.826660216
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.825317442
Please provide your feedback on this answer.
a
That doesn't work.
c
Thank you for your feedback