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'
})
messageRecmitLine({
sublistId: 'otherrecipientslist'
})