Reputation: 11
I am trying to create a message record for a bunch of contacts that are all receiving an email together.
I am using email.send() for the actual email but there is a limitation of only attaching one entity record per email.send().
To work around that I am trying to create a Message record for all the contacts to display all the data under their communication tab.
The issue I'm having is that I am unable to add more than one recipient to the message record.
This is what I am currently trying but I've also tried record.insertLine. I got this error both times. Any advice on where I'm going wrong?
You have attempted an invalid sublist or line item operation. You are either trying to access a field on a non-existent line or you are trying to add or remove lines from a static sublist."
var messageRec = record.create ({
type: record.Type.MESSAGE,
isDynamic: true
});
messageRec.setValue({
fieldId: 'subject',
value: 'Test with CC'
});
messageRec.setValue({
fieldId: 'author',
value: 6863
});
messageRec.setValue({
fieldId: 'authoremail',
value: '[email protected]'
});
messageRec.setValue({
fieldId: 'recipient',
value: 9158
});
messageRec.setValue({
fieldId: 'recipientemail',
value: '[email protected]'
});
messageRec.selectNewLine({
sublistId: 'otherrecipientslist',
})
messageRec.setCurrentSublistValue({
sublistId: 'otherrecipientslist',
fieldId: 'email',
value: '[email protected]'
})
messageRec.setCurrentSublistValue({
sublistId: 'otherrecipientslist',
fieldId: 'cc',
value: 'T'
})
messageRec.commitLine({
sublistId: 'otherrecipientslist'
})
Upvotes: 1
Views: 37
Reputation: 41
First, the sublist otherrecipientslist does not exist in the MESSAGE record, as you can see in the following screenshot. And second, the recipient field, as you mentioned, is not a multi-select field, which leaves you with the option of sending one email per recipient if you want the message to appear in the Messages subtab. If it is not necessary for the message to appear in the subtab, you can use the cc field, which allows you to add multiple emails.
Best ERPsof
Upvotes: 0