One custom object to many leads relationship | Community
Skip to main content
New Participant
February 16, 2017
Solved

One custom object to many leads relationship

  • February 16, 2017
  • 2 replies
  • 5436 views

In our CRM we have a one-to-many relationship which we want to represent in Marketo (e.g. a contact category, where each contact relates to single category).

For that purpose we create a Custom Lead Field "CategoryID" and a Custom Object "Category" which linked to a Lead's "CategoryID" field and used as dedup field for a Category object.

We expected that when we create Category object with some ID that shared among leads, all of that leads will be linked to same custom object and share same data.

But in reality only a one of leads (possibly first/last created) linked to Category, all other have no custom object of Category type.

Is it bug, or we doing something wrong? We wasn't find any restrictions or workarounds in documentation.

How do you implements one-to-many relationship in Marketo?

Best answer by Grégoire_Miche2

Hi Andrey,

What you want to do is to have the lead having a lookup field towards a custom object. The field would be the category ID and the custom object would be the list of potential categories, each lead pointing to one and only one category, but many leads being able to have the same category.

But in fact one cannot create a strict one-to-many lead-custom object relationship in Marketo. In other term, one cannot have a field in the lead table that is a lookup to a custom object.

Consider Marketo database more as a start schema with the lead table at the center than a true relational DB.

The workaround is to create a N-N relationship and limits it usage in one way. N-N relatioships are created with 2 tables: one is the target table and another one is the join table that has fields looking up to both the lead and the target table. Then, in this join table, you can make it  1-n relationship through making the lookup field to the lead table a unique.

-Greg

2 replies

Grégoire_Miche2
Grégoire_Miche2Accepted solution
New Participant
February 17, 2017

Hi Andrey,

What you want to do is to have the lead having a lookup field towards a custom object. The field would be the category ID and the custom object would be the list of potential categories, each lead pointing to one and only one category, but many leads being able to have the same category.

But in fact one cannot create a strict one-to-many lead-custom object relationship in Marketo. In other term, one cannot have a field in the lead table that is a lookup to a custom object.

Consider Marketo database more as a start schema with the lead table at the center than a true relational DB.

The workaround is to create a N-N relationship and limits it usage in one way. N-N relatioships are created with 2 tables: one is the target table and another one is the join table that has fields looking up to both the lead and the target table. Then, in this join table, you can make it  1-n relationship through making the lookup field to the lead table a unique.

-Greg

TapacAuthor
New Participant
February 20, 2017

You mean that the only way is to create new custom object per lead and keep it's in sync?

I.e. when I want to change custom object's state I have to search all custom objects with "Category ID" and then update all of them instead of single one?

It looks really not cool, because can lead to data inconsistency.

Can you explain your workaround more closely? Are you suggest a maintaining relationship on our CRM side?

Grégoire_Miche2
New Participant
February 20, 2017

Hi Andrey,

No, this is not what I wrote

The workaround I suggest is made of 2 custom objects, one to store the category and another one to link the lead to the category. If you want to change the category name, you just change it once in the category object.

BTW, why would you need to have a custom object to store a simple category name? Do you have other attributes that come with it? Otherwise, a simple field in the lead object should be sufficient.

-Greg

SanfordWhiteman
New Participant
February 16, 2017

Please move the thread to Products and someone will answer it there. "Community" is for website feedback -- and yes, this is confusing!

TapacAuthor
New Participant
February 17, 2017

Thank you. I hope that transferring question to a right place will help, because support still can't reply any useful information.