Velocity Script - Custom Account Object | Community
Skip to main content
Level 1
February 2, 2016
Question

Velocity Script - Custom Account Object

  • February 2, 2016
  • 2 replies
  • 2516 views

Hello, I'm new to Velocity scripting and have a general question.

We have a custom account object built in SFDC. This object is basically an extension of the account team where multiple product specialists are assigned to each account.  The object is sync'd to Marketo and I'm able to see the object and related fields. One of the fields on the object is 'Role'.  This field indicates the product specialty for each team member. 

I was hoping to have 'select' functionality within the scripting that would allow me to segment the team members I want to utilize within tokens.  However, the if/then logic I have been trying is ignored.

Is it possible to target specific records of the custom object and use their related attributes as tokens?

For example:

#if(${Account_Marketo_Team_Member__cList.get(0).Role__c} == "Sales Exec-ProductXX")

    #set (${Account_Marketo_Team_Member__cList.get(0).Basic_Name__c})

Result:

Returns the individuals name from the first row of the accounts custom object regardless of Role.

Thanks

Ryan

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

2 replies

Justin_Cooperm2
Level 10
February 2, 2016

Did you ensure to check the checkbox of the custom object in the right-hand pane of the Email Script Token editor? Only checked objects will be available to you to iterate over within the script.

Level 2
February 2, 2016

Hi Justin.  Yes, the Role field of the custom object is checked.

Justin_Cooperm2
Level 10
February 2, 2016

Ryan,

Try changing the script:

#set ( $role = ${Account_Marketo_Team_Member__cList.get(0).Role__c} )

#if($role == "Sales Exec-ProductXX")

$role.Basic_Name_c

EDIT: ooops, I meant:

#set ( $member = ${Account_Marketo_Team_Member__cList.get(0)} )

#if($member.Role_c == "Sales Exec-ProductXX")

$member.Basic_Name_c

Justin_Cooperm2
Level 10
February 4, 2016

We solved Ryan's problem. The script was missing a '_' from one of the variable names.