Jared Fraley
03/17/2023, 5:28 PMLucas
03/17/2023, 5:41 PM/**
* @NApiVersion 2.x
* @NScriptType UserEventScript
*/
define(['N/record'], function(record) {
function beforeSubmit(context) {
var customRecord = context.newRecord;
// Get the item from the custom record
var itemId = customRecord.getValue({
fieldId: 'custrecord_your_item_field' // Replace with your item field ID
});
// Use lookupField to get the record type of the item
var itemRecordType = record.lookupField({
type: record.Type.ITEM,
id: itemId,
fieldId: 'recordtype'
});
// Log the item record type
log.debug('Item Record Type', itemRecordType);
}
return {
beforeSubmit: beforeSubmit
};
});
Lucas
03/17/2023, 5:43 PMbattk
03/17/2023, 6:21 PMbattk
03/17/2023, 6:25 PMbattk
03/17/2023, 6:25 PM