Custom Objects - Multiple "Accounts" Needing Multiple Emails to Same Lead | Community
Skip to main content
New Participant
February 6, 2023
Solved

Custom Objects - Multiple "Accounts" Needing Multiple Emails to Same Lead

  • February 6, 2023
  • 1 reply
  • 2293 views

Hello all,

We're finalizing a project to move all customer data to Custom Objects, and one scenario has me a bit stuck. We have an object called "Accounts" that has a fair number of fields for customer account data. There is typically more than one account per Lead (obviously).

 

The struggle is - we send out a monthly email if customers are not meeting criteria for a certain account. Some customers may have more than one account and need an email for each account missing criteria.

 

Each account has a unique Account ID to tie the necessary information to the right account, but how would I approach a velocity script that basically goes:

 

01) Look for Account ID

02) Look at Product Description to match X or X

03) Look at three criteria fields and check for FALSE

04) Push the True/False values in a Token

04) Pull in the Last 4 of Account into a Token

 

Just not sure how to approach Marketo seeing each account as it's own thing.

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

Both $list.get(0) and its alternate syntax $list[0] return the 0th item in the array (technically ArrayList).

 

To loop over the ArrayList you use #foreach:

#foreach( $listitem in $list ) ## $listitem is an individual custom object record (LinkedHashMap) with properties ## you can test properties with $listitem.someproperty.equals() and so on #end

 

1 reply

EllenSchwier
New Participant
February 7, 2023

Do you want them to get multiple emails? Or one email with all accounts' information listed? This will change your approach to the Smart List criteria in Marketo as well as the Velocity Script.

 

Also, this is a perfect question to ask Sandford Whiteman.  

New Participant
February 8, 2023

In theory multiple emails - as each email has basically:

 

- Last 4 of account

- pass/fail for requirement 1

- pass/fail for requirement 2

- pass/fail for requirement 3

 

Though if it was within the same email, it still presents the same issue of needing to be able to parse through Account IDs and display the information associated with that specific ID.

 

I get the basic concept for writing a script to output something if a Lead has a specific account overall but I'm unsure of the strategy for saying If Lead has Account Type A and any of these three criteria are FALSE but ensuring that the account type and criteria all are for the same specific account?

 

Something like this would work for a single account

#if ($AccountList.get(0).hasAccountA.equals("1")) && ($AccountList.get(0).hasCriteriaA.equals("0")) Requirements Missed #else Requirements Passed #end

 

Is the (0) the placement in the array? So that would pull the first entry?

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
February 9, 2023

Both $list.get(0) and its alternate syntax $list[0] return the 0th item in the array (technically ArrayList).

 

To loop over the ArrayList you use #foreach:

#foreach( $listitem in $list ) ## $listitem is an individual custom object record (LinkedHashMap) with properties ## you can test properties with $listitem.someproperty.equals() and so on #end