link Marketo custom object - many to many

Highlighted
Level 1

link Marketo custom object - many to many

Hi, 

we have a Marketo custom object that has the top 10 product preferences for each lead. 

Fields

lead number

Prod id 1 - 

prod id 2 - 

prod id 3

etc. 

 

I would like to create email tokens using the product Id on the product preferences and adding product description, image source, and price form webshop. 

 

If I create a Product Description custom object with the following fields (Prods id, description, price and image source) 

1. Is it possible to link the two COs together? using prod ids? How do you link it?

2. Would I be able to use the product description fields in email tokens?

 

I have searched extensively on the community and cannot find examples on how to link it, 

 

Thanks  in advance, 

Maria

8 REPLIES 8
Highlighted
Level 6

Re: link Marketo custom object - many to many

Hi Maria

 

I'm struggling with a similar thing myself....

 

Mine is slightly different, but it might be a similar concept. What I think you would need to do is this: https://docs.marketo.com/display/public/DOCS/Add+Marketo+Custom+Object+Link+Fields#AddMarketoCustomO...

 

So you need an intermediary object with two fields:

 

* Person ID

* Product ID

 

Then you need the other custom object with the product ID (link field) and all the other relevant info.

 

(I think). I need to work out my own one and see how I go! Will update here if I learn any more.

Highlighted
Level 10 - Community Moderator

Re: link Marketo custom object - many to many

Before we get into the linking, let me say you won't be able to access the 2nd-level object from Velocity. So if that's a requirement, you don't want to go down this route.

Highlighted
Level 1

Re: link Marketo custom object - many to many

Hi Stanford, 

I was afraid of not being able to use it on the tokens.

I found this discussion where you suggest to replicate all the records in the auxiliary table (your Library items) into their own Velocity token as a HashMap. 

Do you have more information on this? any reference articles to investigate? 

thanks

Highlighted
Level 1

Re: link Marketo custom object - many to many

Highlighted
Level 10 - Community Moderator

Re: link Marketo custom object - many to many

At simplest, you'd have a map like this:

 

#set( $productDetailLookup = {
  "ABCDE" : {
     "description" : "Product 1", 
     "price" : 200,
     "imageSource" : "http://example.com/1.jpg"
  },
  "FGHIJ" : {
     "description" : "Product 2", 
     "price" : 300,
     "imageSource" : "http://example.com/2.jpg"
  }
] )

 

 

The keys of this map are your Product IDs, so if $productID were the ID, just seek that key:

 

#set( $productDetail = $display.alt($productDetailLookup[$productID],{}) )

 

 

Highlighted
Level 1

Re: link Marketo custom object - many to many

Hi,

Thanks,  yes I am familiar with that code. However, due to the large number of products on our store, how do you compress the code to fit with velocity limits?

 

Highlighted
Level 10 - Community Moderator

Re: link Marketo custom object - many to many

There's a limit to how much you can compress. Obviously removing any duplication like your domain name is a first step. You could also store the values as, say, |-delimited rows instead of in the Map/List JSON-ish syntax, which wastes a ton of characters on repeated key names.

Highlighted
Level 6

Re: link Marketo custom object - many to many

Oh crap, really? That stinks. 

 

We could possibly use the HashMap option. I'll look into that.