How to make a field append only with no duplication? | Community
Skip to main content
Cliff_Lin
Level 2
March 2, 2018
Solved

How to make a field append only with no duplication?

  • March 2, 2018
  • 1 reply
  • 4426 views

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).

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

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.

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
March 2, 2018

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
June 27, 2019

Hi Sanford,

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

Thanks,

Milly

SanfordWhiteman
Level 10
June 28, 2019

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:

... 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).