We have some emails where we use script tokens to sort the opportunities on a person's record by a datetime field and output a data value from the opportunity with the newest datetime in that specific field. However, we're finding that the tokens periodically fail, resulting in the email soft bouncing (the sender name and email address are two of the fields output by these tokens).
However, when I look at the records on which they fail, the required sort fields are all present on the opportunity at the point that the email sends, so I'm at a loss as to why they fail.
Has anyone encountered this? Attached example of the token script:
#if( !$OpportunityList.isEmpty() )
#set( $OpportunityListRecentFirst = $sorter.sort($OpportunityList,["vu_vurpurpose:desc","vu_vurattached:desc"]) )
${OpportunityListRecentFirst[0].rss_hbcemail}
#end
All fields are checked on the token sidebar. The first datapoint is a string with only two possible values, and the second is the datetime field used to sort by most recent value.
We use a Microsoft Dynamics CRM in case that's pertinent, with the dynamics stakeholder grid deployed so that multiple people can be associated with an individual opportunity
Any insights or suggestions would be much appreciated.
Solved! Go to Solution.
Barry and I deciphered this offline, it was actually a question of unexpected null values (which had been thought impossible due to CRM-side rules when creating Opportunities).