Identify Specific Custom Object Data with Repeated Fields | Community
Skip to main content
New Participant
May 12, 2021
Solved

Identify Specific Custom Object Data with Repeated Fields

  • May 12, 2021
  • 1 reply
  • 1651 views

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

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.

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
May 12, 2021

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.

New Participant
May 13, 2021

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