Many-to-many Custom Objects in Tokens | Community
Skip to main content
November 14, 2017
Question

Many-to-many Custom Objects in Tokens

  • November 14, 2017
  • 3 replies
  • 6135 views

Hi,

I have two Custom Objects defining articles I wish to email to each lead, structured as follows:

  • Library: a list of articles with unique IDs
  • Index: two link fields, one to Lead and one to Library

When I view the lead detail page, I can see the Library items associated with each Lead via Index. However, when I try to create a token to include the articles in an email, I can only see the Index object.

Is there a way for me to reference the Library records in the token?

Thanks in advance

James

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

3 replies

SanfordWhiteman
Level 10
November 14, 2017

The second-level objects won't be accessible from Velocity, an unfortunate shortcoming that isn't well-publicized.

We engineer around this by replicating all the records in the auxiliary table (your Library items) into their own Velocity token as a HashMap.  Then we join the first-level objects to the HashMap. You can hold hundreds, maybe thousands, of Library records this way, though it's not unlimited.

November 15, 2017

Thanks Sanford. That's frustrating, I was hoping that this structure would help us get around the API, Batch Size, and Custom Object limits which we're currently coming up against. Back to the drawing board, I guess.

SanfordWhiteman
Level 10
November 15, 2017

How big is your Library, how wide are the fields (data types and number of fields), and how often does it change?

Nate_Anderson-2
Level 2
February 15, 2019

This is pretty disappointing. So outside of the elaborate HashMap scheme you outlined above, we are forced to flatten any custom object data we'd like to inject into emails into contact-keyed structures?

SanfordWhiteman
Level 10
February 15, 2019

Not any custom object data: 2nd-level relationships via Company/Account are fine (as are Oppties of course). 2nd-level via Lead/Contact, yes, the data needs to be flattened to the 1st level in order to be read from Velocity.

Stephen_Schmuhl
Level 2
February 15, 2019

I've run into this before and we were able to overcome the issue using Apex and sending the email out of Salesforce, rather than Marketo. Flattening the object into a custom object in Marketo might work as well, but if you have a good Salesforce Developer you've got another potential option.

Alex_Firtl
Level 2
July 15, 2019

Hey Stephen, do you have any more information on how you handled this via Apex? I would be interested in learning more, in case this could help us out with a similar situation.