从 RESTlet 创建案例,包括附件

Create case from RESTlet, including attachment

如何从 RESTlet 创建支持案例记录,包括发送的电子邮件中的附件。

                var createCase = record.create({ type: record.Type.SUPPORT_CASE })
                createCase.setValue({ fieldId:'company',value:company })
                createCase.setValue({ fieldId:'customform',value:parseData.caseform })
                createCase.setValue({ fieldId:'title',value:parseData.subject })
                createCase.setValue({ fieldId:'email',value: parseData.email })
                createCase.setValue({ fieldId:'incomingmessage',value: parseData.message })
                createCase.save()

使用此代码,创建案例记录,客户根据标准 NetSuite 功能发送电子邮件。但是我们可以在该邮件中添加附件吗?我正在通过邮递员将该附件作为编码字符串传递。

我可以在 RESTlet 脚本中检索该字符串,但我可以将它传递给邮件发送吗?

一种方法是将附件保存在文件柜中,然后将其附加到您通过 SuiteScript 发送的电子邮件中。

const fileObj  = file.load({
    id: fileId
}); 
email.send({
    author: authorId,
    recipients: customerEmail,
    subject: 'Test Email from Case',
    body: 'Test',
    attachments: [fileObj],
    relatedRecords: {
        activityId: caseId
    }
});

您也可以选择将文件附加到案例记录。

record.attach({
    record: {
        type: 'file',
        id: fileId
    },
    to: {
        type: 'supportcase',
        id: caseId
    }
});