m.schuette
10/15/2024, 4:20 PMCeligo AI
10/15/2024, 4:21 PMAI generated answer (using internal Slack threads):Based on the conversations, it seems like you want to calculate the total weight of items when an Item Fulfillment is created and store it in a custom field with the field id of {custbody_fulf_weight}. You can achieve this by creating a User Event script that triggers on the 'After Submit' event of the Item Fulfillment record. In this script, you would loop through each line item, get the weight of the item and the quantity, multiply them together to get the total weight for that line, and then add it to a running total. Once you've looped through all the line items, you would then set the value of the custom field {custbody_fulf_weight} to the total weight. Here's a rough example of what the script might look like:
javascript
function afterSubmit(scriptContext) {
if (scriptContext.type !== scriptContext.UserEventType.CREATE)
return;
var newRecord = scriptContext.newRecord;
var itemCount = newRecord.getLineCount({sublistId: 'item'});
var totalWeight = 0;
for (var i = 0; i < itemCount; i++) {
var weight = newRecord.getSublistValue({
sublistId: 'item',
fieldId: 'weight',
line: i
});
var quantity = newRecord.getSublistValue({
sublistId: 'item',
fieldId: 'quantity',
line: i
});
totalWeight += weight * quantity;
}
newRecord.setValue({
fieldId: 'custbody_fulf_weight',
value: totalWeight
});
}
Please note that this is a simplified example and may need to be adjusted to fit your specific needs. Also, make sure to deploy the script and associate it with the Item Fulfillment record type.
******
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/15/2024, 4:21 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.838386297
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.83508724
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.834336102
Celigo AI
10/15/2024, 4:21 PM