Hello,
We have set up a custom object (account) containing multiple fields (account type, open date, balance, etc.). I need to pull the data of specific account types listed in the custom fields, however, each person record can have multiple accounts, all different types.
For example:
Custom Object: Account
Custom Field: Account type = 1
Custom Field: Open Date = 5/1/2021
Custom Object: Account
Custom Field: Account type = 2
Custom Field: Open Date = 5/1/2000
Custom Object: Account
Custom Field: Account type = 3
Custom Field: Open Date = 5/1/1998
How do I pull the open date for Account type 3 only, using a token in an email?
Solved! Go to Solution.
This is (of course) a Velocity token task — the classic loop-until-break pattern.
#foreach loop over the list of objects until you find a matching object, then #break.
Optionally, you may want to $sorter.sort the list first by a certain field, if there may be more than one object with matching properties and you need to find the latest or earliest matching object.
Lots of examples here on the Community (mostly mine!) and at https://blog.teknkl.com/tag/velocity.
This is (of course) a Velocity token task — the classic loop-until-break pattern.
#foreach loop over the list of objects until you find a matching object, then #break.
Optionally, you may want to $sorter.sort the list first by a certain field, if there may be more than one object with matching properties and you need to find the latest or earliest matching object.
Lots of examples here on the Community (mostly mine!) and at https://blog.teknkl.com/tag/velocity.
Thank you, SanfordWhiteman! We came up with this (below) and it works well. It is pulling a date that is formatted YYY-MM-DD. Is there a way to add additional velocity code to format it to MM-DD-YYYY?
#foreach($item in $share_cList)
#if( $item.shareType == 9 || $item.shareType == 49)
$item.cycleEndDate
#break($foreach)
#end
#end