Xtina
05/17/2022, 12:39 AM/**
*@NApiVersion 2.0
*@NScriptType UserEventScript
*/
define(['N/record', 'N/log'],
function(record, log) {
var Tester_Item = '23361';
function woItemAfterSubmit(context) {
log.debug({
title: 'start',
details: context.type
});
if (context.type != context.UserEventType.EDIT) {
log.debug({
details: "Event is not Edit. Exiting."
});
return;
}
var currentRecord = context.newRecord;
var recId = currentRecord.id;
var woId = currentRecord.getValue({
fieldId: 'custrecord_work_order'
});
var recWorkOrder = record.load({
type: record.Type.WORK_ORDER,
id: woId,
isDynamic: true
});
recWorkOrder.setValue({
fieldId: 'assemblyitem',
value: Tester_Item
});
recWorkOrder.save({
enableSourcing: true,
ignoreMandatoryFields: true
}); //submit canning work orderrecord
}
return {
afterSubmit: woItemAfterSubmit,
};
});
battk
05/17/2022, 2:38 AM