const afterSubmit = (scriptContext) => {
if (scriptContext.type !== scriptContext.UserEventType.EDIT) return;
try {
let noteRecord = scriptContext.newRecord;
let noteId = noteRecord.id;
log.debug(“noteId”, noteId);
let associatedRecordId = noteRecord.getValue(‘record’);
log.debug(“associatedRecordId”, associatedRecordId);
let associatedRecordType = noteRecord.getValue(‘recordtype’);
log.debug(“associatedRecordType”, associatedRecordType);
let suiteletUrl = url.resolveScript({
scriptId: jj_cm_library.SUITELET.scriptId,
deploymentId: jj_cm_library.SUITELET.deployId,
returnExternalUrl: true
})
log.debug(‘suiteletUrl’, suiteletUrl);
let resultCategory = https.post({
url: `${suiteletUrl}&apiType=triggerTicket`,
body: JSON.stringify({
recId: associatedRecordId,
}),
headers: { name: ‘Accept-Language’, value: ‘en-us’ }
})
let apiResponse = JSON.parse(resultCategory.body);
log.debug(‘apiResponse’, apiResponse);
} catch (e) {
log.error(“Error in afterSubmit”, e);
}
}