Tiina Böös
06/04/2025, 8:07 AMCeligo AI
06/04/2025, 8:07 AMAI generated answer (using internal Slack threads):In order to manually calculate the new total of the item sublist after changing the value of the rate field in the fieldChanged function, you would need to multiply the new rate by the quantity for each item in the sublist. Here is a general approach to do this: 1. Get the current record using
var currentRecord = context.currentRecord;
2. Get the line count of the item sublist using var lineCount = currentRecord.getLineCount({sublistId: 'item'});
3. Initialize a variable to hold the total, var total = 0;
4. Loop through each line in the sublist:
for (var i = 0; i < lineCount; i++) {
var quantity = currentRecord.getSublistValue({sublistId: 'item', fieldId: 'quantity', line: i});
var rate = currentRecord.getSublistValue({sublistId: 'item', fieldId: 'rate', line: i});
total += quantity * rate;
}
5. After the loop, the total
variable will hold the new total of the item sublist.
Please note that this is a general approach and might need to be adjusted based on your specific use case. Also, this approach assumes that the 'quantity' and 'rate' fields are available on the item sublist.
******
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/04/2025, 8:07 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.812125504
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.806559503
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.800692379
Celigo AI
06/04/2025, 8:07 AM