【问题标题】:Create case from RESTlet, including attachment从 RESTlet 创建案例,包括附件
【发布时间】:2020-09-12 06:20:45
【问题描述】:

如何从 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 脚本中检索该字符串,但我可以将它传递给邮件发送吗?

【问题讨论】:

    标签: netsuite suitescript2.0


    【解决方案1】:

    一种方法是将附件保存在文件柜中,然后将其附加到您通过 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
        }
    });
    

    【讨论】:

      猜你喜欢
      • 2014-09-05
      • 1970-01-01
      • 2022-10-20
      • 2018-08-03
      • 2021-07-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多