Load Record--->selectLine--->CommitLine--->Save [Set Sublist field Data After Submit]
Tue May 17 2022 09:29:50 GMT+0000 (Coordinated Universal Time)
Saved by
@mdfaizi
function afterSubmit(context) {
var recobj=context.newRecord;
var recid=recobj.id;
log.debug("recid",recid);
function test() {
var So_Rec = record.load({
type: record.Type.VENDOR_BILL,
id: recid,
isDynamic: true,
});
So_Rec.selectLine({
sublistId: 'expense',
line: 0
});
So_Rec.setCurrentSublistValue({
sublistId: 'expense',
fieldId: 'custcol_expense_url',
value: "https://www.googlggggggggggggggggggggggge.com",
});
So_Rec.commitLine({ sublistId: 'expense', ignoreRecalc: false });
var so_RecId = So_Rec.save({
enableSourcing: true,
ignoreMandatoryFields: true
})
log.debug('rec saved', so_RecId);
}
test();
log.debug('test() function end');
}
content_copyCOPY
How to sublist data in AfterSubmit event.
Load Record--->selectLine--->CommitLine--->Save
recobj.setSublistValue({}) wont work in afterSubmit So use above method.
Comments