Tyn Guardian
09/12/2022, 3:45 AMbattk
09/12/2022, 6:34 AMbattk
09/12/2022, 6:35 AMTyn Guardian
09/12/2022, 6:51 AMTyn Guardian
09/12/2022, 6:51 AMbattk
09/12/2022, 7:00 AMTyn Guardian
09/12/2022, 7:08 AMfunction attachFileToRecord(dealRecId, cserId, fileId, version) {
log.audit({title: 'reportToAttachToRecord', details: record1: ${recordId1} record2: ${recordId2} fileId: ${fileId} version: ${version}});
getGovernance();
const fields = [];
fields['aaa'] = fileId;
fields['bbb'] = version;
utility.submitFlds(customrecord_123, recordId1, fields);
utility.attachFileToRecord(fileId, 'customrecord_first', recordId2);
utility.attachFileToRecord(fileId, 'customrecord_second', recordId1);
getGovernance();
}
///utility///
function attachFileToRecord(fileId, recordType, recordId) {
try {
record.attach({
record: {
type: 'file',
id: fileId
},
to: {
type: recordType,
id: recordId
}
});
} catch (e) {
log.debug({title: 'attachFileToRecord', details: e});
}
}
battk
09/12/2022, 7:22 AMbattk
09/12/2022, 7:23 AMbattk
09/12/2022, 7:24 AMbattk
09/12/2022, 7:25 AMTyn Guardian
09/12/2022, 7:26 AMTyn Guardian
09/12/2022, 7:33 AMfunction attachFile(dealRecId, cserId, fileId) {
const fields = [];
fields['file_attachment_fld'] = fileId;
attachFileToRecord(fileId, cfg.CSER.RECTYPE, cserId);
attachFileToRecord(fileId, cfg.DEAL.RECTYPE, dealRecId);
}
function attachFileToRecord(fileId, recordType, recordId) {
try {
record.attach({
record: {
type: 'file',
id: fileId
},
to: {
type: recordType,
id: recordId
}
});
} catch (e) {
log.debug({title: 'attachFileToRecord', details: e});
}
}
function afterSubmit(context) {
// dealRecordId is internal id of the other custom record
// otherRecordId is internal id of the other custom record
attachFile(dealRecordId, otherRecordId, fileId);
}
Tyn Guardian
09/12/2022, 7:34 AMbattk
09/12/2022, 8:50 AMfunction attachFile(dealRecId, cserId, fileId) {
attachFileToRecord(fileId, "customrecord0", cserId);
attachFileToRecord(fileId, "customrecord1", dealRecId);
}
function attachFileToRecord(fileId, recordType, recordId) {
try {
record.attach({
record: {
type: "file",
id: fileId,
},
to: {
type: recordType,
id: recordId,
},
});
} catch (e) {
log.debug({ title: "attachFileToRecord", details: e });
}
}
function afterSubmit(context) {
// dealRecordId is internal id of the other custom record
// otherRecordId is internal id of the other custom record
attachFile("1", "6", "3143");
}
worked for mebattk
09/12/2022, 8:50 AMbattk
09/12/2022, 8:51 AMTyn Guardian
09/12/2022, 9:03 AM