SOLVED

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

Go to solution
nhabischWings
Level 5

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

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.

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

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

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

 

View solution in original post

4 REPLIES 4
EllenSchwier
Level 4

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

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.  

nhabischWings
Level 5

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

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
Level 10 - Community Moderator

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

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

 

nhabischWings
Level 5

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

Got it, thank you!


Would this be used to pull all use cases within one token? Like does #foreach loop through the whole array each time or just until it encounters a match?

What would be the best route if I wanted to output specific values related to each individual instance? For example if someone has 3 Accounts in the Custom Object and 2 of them match the criteria would I do a token for each potential array value?

If my email should display:
Last 4 of Account 1
Pass/Fail Criteria 1 (for Account 1)
Pass/Fail Criteria 2 (for Account 1)

Last 4 of Account 2
Pass/Fail Criteria 1 (for Account 2)
Pass/Fail Criteria 2 (for Account 2)

So you'd have two tokens with that Array value of (0) and then (1)? Or can #foreach be used to output specific values when matched?