Tyn Guardian
01/23/2024, 1:23 AMconst invoiceRec = record.load({
type: record.Type.INVOICE,
id: internalId,
isDynamic: false,
});
const itemCount = invoiceRec.getLineCount({sublistId: 'item'});
if (itemCount == 1) {
log.debug({
title: 'getsublist equal to 1',
details: `0`
});
invoiceRec.setSublistValue({
sublistId: 'item',
fieldId: 'taxcode',
line: 0,
value: -7,
// ignoreFieldChange: true
});
}
invoiceRec.save();
const invoiceRecButton = record.load({
type: record.Type.INVOICE,
id: internalId,
isDynamic: true,
});
const macros = invoiceRecButton.getMacros();
log.debug({
title: 'InvoiceMR2',
details: `macros: ${JSON.stringify(macros)}`
});
if ('calculateTax' in macros) {
// macros.calculateTax();
invoiceRecButton.executeMacro({ id:'calculateTax' });
}
invoiceRecButton.save();
Gregory
02/26/2024, 1:00 PMTyn Guardian
02/28/2024, 12:12 AM