SOLVED

How to make a field append only with no duplication?

Go to solution
Cliff_Lin
Level 1

How to make a field append only with no duplication?

We sell different lines of software to customers so we have a field called Product_Interest. However, i'm having difficulty dealing with these two criteria for setting up the field.

1. The data appends instead of overwriting (Product A, Product B...etc)
2. If the same data exists, it doesn't append(Product A for product interest and if they bought it again the field would remain (product A) instead of (Product A, Product A).

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: How to make a field append only with no duplication?

You can do this with 2 fields and a webhook.

You have the new interest {{lead.Last_Product_Interest}} plus the historical field {{lead.All_Product_Interests}}.

Trigger on Data Value Changes to Last_Product_Interest.  In the flow, call a webhook, passing it the current values of both fields. The webhook handles the deduping and sends you back the new value of All_Product_Interests with just the unique names.

Of course the other way is to simply use individual Datetime fields instead. They're cheap (in terms of storage) and give you more information. Each time somebody shows interest in a Product, set the Datetime field ({{lead.Product_A_Last_Hand_Raise}}, {{lead.Product_B_Last_Hand_Raise}}, etc.) to {{system.datetime}}. This way you know not only that someone has shown interest but when they were last interested -- a win-win.

View solution in original post

7 REPLIES 7
SanfordWhiteman
Level 10 - Community Moderator

Re: How to make a field append only with no duplication?

You can do this with 2 fields and a webhook.

You have the new interest {{lead.Last_Product_Interest}} plus the historical field {{lead.All_Product_Interests}}.

Trigger on Data Value Changes to Last_Product_Interest.  In the flow, call a webhook, passing it the current values of both fields. The webhook handles the deduping and sends you back the new value of All_Product_Interests with just the unique names.

Of course the other way is to simply use individual Datetime fields instead. They're cheap (in terms of storage) and give you more information. Each time somebody shows interest in a Product, set the Datetime field ({{lead.Product_A_Last_Hand_Raise}}, {{lead.Product_B_Last_Hand_Raise}}, etc.) to {{system.datetime}}. This way you know not only that someone has shown interest but when they were last interested -- a win-win.

Milly_Tsui
Level 2

Re: How to make a field append only with no duplication?

Hi Sanford,

Would you be able to provide a screenshot of the webhook setup for this? 

Thanks,

Milly

SanfordWhiteman
Level 10 - Community Moderator

Re: How to make a field append only with no duplication?

If you want, this is a screenshot of a production 'hook that updates a multivalued ProductInterests field (semicolon-delimited as usual in Marketo) without dupes:

pastedImage_1.png

... but this isn't something you can just duplicate in your instance! You see, the service called by this webhook runs that bit of JS, splits the {{lead.token}} values to get a temp array, does the insert/dedupe thing and turns it back into a string. Then the string result (the allInterestsStringified response) gets mapped back to ProductInterests in Marketo.

You might have any number of ways of calling/authoring the webhook-compatible service. What many (most?) people don't understand is the "webhook" part is actually the app making the outbound connection, in this case Marketo.  It's the server on the other side that does the actual work (calculations, lookups, other calls to even more services, etc.). The webhook setup (in Admin » Webhooks) is so you can set the correct payload, field mappings, special authorization headers, and so on required by that server. So as long as you're set up in Admin, even if the server on the other side is down -- or doesn't even exist! -- you nonetheless have a "webhook" (obviously not a useful one, but as long as you're trying to make an outbound connection from a trigger Smart Campaign, that's the tightest definition).

Milly_Tsui
Level 2

Re: How to make a field append only with no duplication?

Thank you for the screenshot and detailed explanation, Sanford! I will test this out and let you know if I have further questions. 

Kind regards,

Milly

Milly_Tsui
Level 2

Re: How to make a field append only with no duplication?

Hi Sanford Whiteman‌, would you be able to provide the name of the third-party web service provider you used for this webhook? I've been scouring the discussions and other online resources for webhooks that can de-dupe a multi-valued field, but sadly most of my searches yield results for webhooks that can de-dupe leads. 

SanfordWhiteman
Level 10 - Community Moderator

Re: How to make a field append only with no duplication?

Not allowed to name it due to Community guidelines.

Milly_Tsui
Level 2

Re: How to make a field append only with no duplication?

That is what I figured - thanks anyways!