Give an example of how to User record.submitFields
# ask-stanley-ai
r
Give an example of how to User record.submitFields
c
AI generated answer (using internal Slack threads):
The
record.submitFields
method in SuiteScript allows you to update specific fields on a record without loading the entire record into memory. This can be more efficient than
record.load
or
record.create
when you only need to update a few fields. Here's an example of how to use `record.submitFields`:
Copy code
javascript
var recordId = record.submitFields({
    type: record.Type.SALES_ORDER,
    id: '123',
    values: {
        'custbody_some_custom_field': 'New Value',
        'custbody_another_custom_field': 'Another Value'
    }
});
In this example, we're updating a Sales Order record with the internal ID of '123'. We're setting the values of two custom fields, 'custbody_some_custom_field' and 'custbody_another_custom_field', to 'New Value' and 'Another Value' respectively. The
record.submitFields
method returns the internal ID of the record that was updated. ****** 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.833218396
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.832985759
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.831393778
Please provide your feedback on this answer.