darrenhillconsulting
10/21/2024, 7:06 PMCeligo AI
10/21/2024, 7:06 PMAI generated answer (using internal Slack threads):In SuiteScript 2.1, you can set a field by text-value when using
record.submitFields
by using the values
parameter. This parameter accepts an object where the keys are the field IDs and the values are the field values you want to set.
Here is an example of how you can do this:
javascript
var fieldId = 'custrecord_tran_packages_tran_link';
var fieldValue = 'Sales Order #' + orderNum;
var values = {};
values[fieldId] = fieldValue;
var returnId = record.submitFields({
type: 'customrecord_your_custom_record',
id: yourRecordId,
values: values
});
In this example, fieldId
is the ID of the field you want to set, and fieldValue
is the text value you want to set for that field. The values
object is then used as the values
parameter in the record.submitFields
method.
Please note that the record.submitFields
method only works for fields that are not part of a sublist or a matrix field. If you need to set a sublist or matrix field, you will need to load the entire record using the record.load
method and then use the record.setSublistValue
or record.setMatrixValue
methods.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
10/21/2024, 7:06 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.851761401
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.840001881
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.83827
Celigo AI
10/21/2024, 7:06 PM