Nour
06/24/2025, 12:12 PMCeligo AI
06/24/2025, 12:12 PMAI generated answer (using internal Slack threads):Based on the conversations, you can achieve the multiplication of two fields and setting the result in a third field using SuiteScript. You can use a Client Script and the
fieldChanged
event to perform the calculation whenever the values of the two fields are changed.
Here is a sample code snippet:
javascript
define(['N/record','N/search','N/ui/dialog', 'N/log'], function (record, search, dialog, log) {
/**
*@NApiVersion 2.0
*@NScriptType ClientScript
*/
function fieldChanged(context) {
var currentRecord = context.currentRecord;
if(context.fieldId == "field1" || context.fieldId == "field2") {
var field1 = currentRecord.getValue({
fieldId: 'field1'
});
console.log(field1);
var field2 = currentRecord.getValue({
fieldId: 'field2'
});
console.log(field2);
var result = field1 * field2;
console.log(result);
if (field1 && field2) {
currentRecord.setValue({
fieldId: 'field3',
value: result,
ignoreFieldChange:true
});
}
}
}
return {
fieldChanged: fieldChanged
};
});
In this script, replace field1
, field2
, and field3
with the actual field IDs of your custom sublist. This script will trigger every time there is a change in field1
or field2
, calculate the multiplication of field1
and field2
, and set the result in field3
.
******
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
06/24/2025, 12:13 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.854231596
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.840154886
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.836543262
Celigo AI
06/24/2025, 12:13 PM