How to attach the PDF file into a custom record

function customerPdfAttachment(newRecord, cusId) {
            try {
                let fileId = generatePdf(newRecord);
                if (checkForParameter(cusId) && checkForParameter(fileId)) {
                    record.attach({
                        record: {
                            type: 'file',
                            id: fileId
                        },
                        to: {
                            type: 'customer',
                            id: cusId
                        }
                    });
                }
                return fileId;
            }
            catch (err) {
                log.error("error@customerPdfAttachment", err);
                return null;
            }
        }

Leave a comment

Your email address will not be published. Required fields are marked *