Lee Brookes
02/10/2025, 4:23 PMCeligo AI
02/10/2025, 4:23 PMAI generated answer (using internal Slack threads):To trigger a quality inspection from an item receipt, you can use a SuiteScript. Here's a general idea of how you can do it: 1. Create a User Event script that triggers on the 'After Submit' event of the Item Receipt record. 2. In the script, check if the Item Receipt record has any line items that require quality inspection. 3. If there are items that require inspection, create a new Quality Inspection record and link it to the Item Receipt record. Here's a pseudo-code example:
javascript
function afterSubmit(context) {
if (context.type !== context.UserEventType.CREATE) {
return;
}
var itemReceipt = context.newRecord;
var lineCount = itemReceipt.getLineCount({sublistId: 'item'});
for (var i = 0; i < lineCount; i++) {
var item = itemReceipt.getSublistValue({sublistId: 'item', fieldId: 'item', line: i});
if (itemRequiresInspection(item)) {
createQualityInspection(itemReceipt, item);
}
}
}
function itemRequiresInspection(item) {
// Check if the item requires inspection
// This will depend on your business logic
}
function createQualityInspection(itemReceipt, item) {
var qualityInspection = record.create({type: 'customrecord_quality_inspection'});
qualityInspection.setValue({fieldId: 'custrecord_item_receipt', value: itemReceipt.id});
qualityInspection.setValue({fieldId: 'custrecord_item', value: item});
qualityInspection.save();
}
Please replace 'customrecord_quality_inspection', 'custrecord_item_receipt', and 'custrecord_item' with your actual Quality Inspection record type and field IDs.
******
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
02/10/2025, 4:24 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.842776597
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.832395136
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.803576946
Celigo AI
02/10/2025, 4:24 PM