How to access custom object with intermediary object.

Not applicable

How to access custom object with intermediary object.


I'm new to Marketo. I have to set up Maketo. Whereas my requirement is like. We have Leads, Course Registrations and Courses.

The structure should be like this below:

Course Registration (Custom Object)
Course (Custom Object)
LeadIdRegistrationId (Dedupe Field)CourseId (Dedupe Field)
NameLeadId (Link Field with Lead Object)CourseName
PhoneCourseId (Link Field with Course Object)LessonName1

So each of lead can have multiple registrations whereas each registration should be connected to one course.

I have created above structure in Marketo and Add some dummy data for testing a campaign. I have to send a lesson reminder email of 24 hours, 12 hours, 6 hours, 3 hours and 1 hour to students who have registered for a course.

I have created a test campaign for the lesson1 reminder email and tried to access the course through script token but not able to access Course Fields because I can only see Course Registration Custom Object in RHS pane in the token editor.

Could you please help me here to access Lesson Name and Course Name from Course Object. And also suggest me that I'm using the right structure in Marketo for my requirement.

Thanks in Advance.

Level 10 - Community Moderator

Re: How to access custom object with intermediary object.

You can't access 2nd-level objects from Velocity, so no, this isn't the right structure.

If you search past threads for "second level objects" or other variations, you'll see this discussed at length.

Not applicable

Re: How to access custom object with intermediary object.

Hi Sanford,

Could you please tell me the right structure for this requirement.


Level 10

Re: How to access custom object with intermediary object.

Have only 1 course registration object, linked to the person objet, and recopy into it all the fields of the course object that you might need.


Level 10

Re: How to access custom object with intermediary object.

BTW, this is called database denormalization. Reminds me my early days. Denormalization - Wikipedia

Level 2

Re: How to access custom object with intermediary object.

For anyone looking for more details on the setup in the question:

  • In your Salesforce Object Sync, you would enable sync on the "Courses" object. Leave "Course Registrations" grayed out. Those Course Registration objects will come over because of "Sync Implied".
  • Wait until all the Course objects come through in the sync. It'll take a while. You can see the object count in Marketo Vs. SFDC object count when you click on the details of the object
  • Remember that the mapping between Leads->Course Registrations->Courses is done through a lookup kind of field. Which means that the Lead needs to have been updated/modified in order for Marketo to pull in the related connection to Courses. So each time you add a course, make sure to also update the Lead in some way.

And, if you are here because you're looking for a way to have Leads + Contacts point to multiple objects through an intermediary object, here is an example of something I tested.


Here is our setup. There is a Many-to-many mapping that can happen between Leads, Accounts and "Tenant" objects. This is done through an intermediary "Tenant Mapping" object. To complicate things, the Lead and Account could point directly to a Tenant, not going through an intermediary object (but I didn't care about that scenario for Marketo setup purposes).
Our setup in SalesforceOur setup in Salesforce

This is what the Salesforce Object Sync map looks like when you refresh the schema. You can see that, under the Lead, there is a "Tenant" listed directly (this is for getting the tenant that's directly linked to the Lead), and there is a "Tenant Mapping" with a "Tenant - Lead" underneath. That's the one we want to sync over - because it uses the many-to-many intermediate object. Note that "Tenant - Lead" and "Tenant - Account" originally came through as just "Tenant". You have to rename them so they're unique. Marketo will pull the data only once (it won't create copies of the Tenant rows) - this is just a cosmetic renaming you need to do.


Sync only the objects in green. Marketo will "implied sync" the intermediate object.

How Marketo Object sync sees thingsHow Marketo Object sync sees things

Detailed view. You can see how many of the Tenant objects are available in SFDC, vs. how many were brought over to Marketo. If you refresh this window during initial sync, you'll see the Marketo go up on each refresh.
Details from the Lead->Tenant mappingDetails from the Lead->Tenant mapping

The result:

  • For people who are SFDC Leads, Marketo is aware of all the Tenant objects connected to them.
  • For Contacts, Marketo will look into the Tenants associated with the Account they belong to. That means all the Contacts under an Account will be aware of all the Tenants that the Account is connected to. 
  • Again, because the linkage between Lead->Tenant and Account->Tenant is a lookup field, Marketo won't update the Tenant data until the Lead or the Account is updated. Each time you alter/add a Tenant / Tenant Mapping record, you have to update the associated Lead/Account.
  • Because the Tenant objects have different names and are seen as different filter conditions, your filters have to check both: in case the Marketo Person is a SFDC Lead or a SFDC Contact

Huge thanks to Veronica Holmes who explained a lot of this in the following video: