Velocity Script using Salesforce Custom Object | Community
Skip to main content
Ayush_Aggarwal1
Level 2
November 13, 2019
Question

Velocity Script using Salesforce Custom Object

  • November 13, 2019
  • 1 reply
  • 5328 views

Hi Marketo Users,

I have a case wherein I want to create a velocity script to populate the Account Team member name in the From field of the email. This information is available at the Account level in SFDC as a custom object. I can sync in the Custom object into Marketo, but want to leverage the information at the custom object into the velocity script.

Can anyone please help me on how can I build a velocity script using Salesforce Custom Objects?

Regards,

Ayush Aggarwal

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

1 reply

SanfordWhiteman
Level 10
November 13, 2019

This isn't really a question about "Salesforce Custom Objects". It's specific to your Custom Object, which appears to have a 2nd-level relationship to the Contact.

If you do see this CO in Smart List filters, but do not see it in the Velocity field tree (on the right-hand side of Script Editor) then it can't be accessed from Velocity.

2nd-level Custom Objects are typically not accessible (some 2nd-level system objects are still available, for example an Oppty is technically a 2nd-level relationship).

Ayush_Aggarwal1
Level 2
November 21, 2019

Hi @Sanford Whiteman‌,

Yes, the Salesforce custom object appeared in the velocity script editor. I am trying to pull the Account team member name from the custom object, but the field is not available at the object. Below you find the screenshot for the same.

I want to use the Account Team member name and email address as the sender name and from email address in the emails. However, both the fields are not available at the custom object. Also, there is another condition, the name and email address should only populate if the "Team Role" is "Customer Success Representative". I know it's commented in there since I was still trying to fetch the name and email address for the account team member.

Any help here is appreciated.

Regards,

Ayush Aggarwal

SanfordWhiteman
Level 10
November 21, 2019

Well, to begin with, that #foreach wouldn't make sense even if the property were exposed in Velocity. You're looping over the list and then get-ting (or trying to get) the Name property of the first item in the list, regardless of which item you're currently looking at.

But to the point of the Name property not being in the Script Editor tree, there are 2 possible explanations:

  • you're mistaking it for a field on this CO, it's actually a field on another related CO
  • your API user doesn't have access to read this field