3

我正在使用 N/email 模块发送一封我想附加到多个交易的电子邮件。通过使用以下代码的单个事务,我没有问题:

email.send({
    author: -5,
    recipients: recipient,
    subject: subject,
    body: body,
    relatedRecords: {
        transactionId: 8
    }
});

但是,文档确实暗示,当它说 transactionId 应该是时,我们可以关联多个事务

与消息记录关联的事务记录。

但是,以下示例均无效。所有这些电子邮件都正确发送,但它没有附加到任何一个交易中。我有点不知所措。

// Example 1
email.send({
    author: -5,
    recipients: recipient,
    subject: subject,
    body: body,
    relatedRecords: { transactionId: [8,10] }
});

// Example 2
email.send({
    author: -5,
    recipients: recipient,
    subject: subject,
    body: body,
    relatedRecords: [{ transactionId: 8 }, { transactionId: 10 }]
});

// Example 3
email.send({
    author: -5,
    recipients: recipient,
    subject: subject,
    body: body,
    relatedRecords: { transactionId: '8,10' }
});

这应该如何实现?

4

1 回答 1

1

我不确定你是否解决了这个问题,但我相信它应该是这样的:

email.send({
    author: -5,
    recipients: recipient,
    subject: subject,
    body: body,
    relatedRecords: { transactionId:8,transactionId:10 }
});

“relatedRecords:包含键/值对的对象,用于将消息记录与相关记录(包括自定义记录)相关联。”

于 2017-12-29T06:49:02.890 回答