alien4u
06/30/2020, 7:39 PMBen Tanner
06/30/2020, 7:41 PMalien4u
06/30/2020, 7:42 PMBen Tanner
06/30/2020, 7:42 PMBen Tanner
06/30/2020, 7:43 PMalien4u
06/30/2020, 7:43 PMBen Tanner
06/30/2020, 7:44 PMalien4u
06/30/2020, 7:44 PMMTNathan
06/30/2020, 7:45 PMalien4u
06/30/2020, 7:46 PMBen Tanner
06/30/2020, 7:46 PMalien4u
06/30/2020, 7:47 PMBen Tanner
06/30/2020, 7:50 PMfunction getToRecipients(myRecord) {
log.debug({title: 'Checking for To recipients'});
var recipientIds = [];
var mainOnboardContact = myRecord.getValue({fieldId: 'custrecord_implementation_main'});
if (mainOnboardContact != '' && recipientIds.indexOf(parseInt(mainOnboardContact)) == -1)
recipientIds.push(parseInt(mainOnboardContact));
var mainRosterContact = myRecord.getValue({fieldId: 'custrecord_implementation_rostering'});
if (mainRosterContact != '' && recipientIds.indexOf(parseInt(mainRosterContact)) == -1)
recipientIds.push(parseInt(mainRosterContact));
var mppOnboardContact = myRecord.getValue({fieldId: 'custrecord_ob_mpp_onboarding_contact'});
if (mppOnboardContact != '' && recipientIds.indexOf(parseInt(mppOnboardContact)) == -1)
recipientIds.push(parseInt(mppOnboardContact));
var mppRosterContact = myRecord.getValue({fieldId: 'custrecord_ob_mpp_roster_contact'});
if (mppRosterContact != '' && recipientIds.indexOf(parseInt(mppRosterContact)) == -1)
recipientIds.push(parseInt(mppRosterContact));
var mathOnboardContact = myRecord.getValue({fieldId: 'custrecord_ob_math_onboarding_contact'});
if (mathOnboardContact != '' && recipientIds.indexOf(parseInt(mathOnboardContact)) == -1)
recipientIds.push(parseInt(mathOnboardContact));
var mathRosterContact = myRecord.getValue({fieldId: 'custrecord_ob_math_roster_contact'});
if (mathRosterContact != '' && recipientIds.indexOf(parseInt(mathRosterContact)) == -1)
recipientIds.push(parseInt(mathRosterContact));
var galOnboardContact = myRecord.getValue({fieldId: 'custrecord_ob_gal_onboarding_contact'});
if (galOnboardContact != '' && recipientIds.indexOf(parseInt(galOnboardContact)) == -1)
recipientIds.push(parseInt(galOnboardContact));
var galRosterContact = myRecord.getValue({fieldId: 'custrecord_ob_gal_roster_contact'});
if (galRosterContact != '' && recipientIds.indexOf(parseInt(galRosterContact)) == -1)
recipientIds.push(parseInt(galRosterContact));
if (recipientIds.length > 0)
log.debug({title: 'Recipients', details: recipientIds});
return recipientIds;
}
Ben Tanner
06/30/2020, 7:55 PMMTNathan
06/30/2020, 7:58 PMrecipientIds
look like when you're logging it?Sandii
06/30/2020, 8:00 PMBen Tanner
06/30/2020, 8:04 PMalien4u
06/30/2020, 8:29 PMalien4u
06/30/2020, 8:30 PMMTNathan
06/30/2020, 8:42 PMemail.send()
- I'd be curious to know for sure where the limitations are for recipients
.Azi
06/30/2020, 8:55 PMAzi
06/30/2020, 8:57 PMBen Tanner
06/30/2020, 11:15 PMif (recipients.length = 0) {…
ended up clearing the array right before the email.send()
call. Gah I hate those little errors.
To confirm for others, my testing showed no difference between passing an array with a single value or multiple values, ids formatted as strings or ints, ids for employees or contacts. All combinations worked once I resolved my error.
Thanks again for the ideas.