SOLVED

Comparing and validating form data

Go to solution
Travis_Schwartz
Level 4

Comparing and validating form data

Hello,

 

I'm being asked if there is a way to have a form and have Marketo look at the fields (still trying to identify what fields, but for security purposes, it would need to be more than email address). Is there a way for Marketo to compare the form entry to information on a record? do email, address, name, etc all match an existing record? if so send a confirmation email. We don't currently have passwords saved in Marketo... but it's sort of like a forgot username situation. We just need more than an email address to give the relevant information.

 

I'm not really seeing a way of doing it in Marketo alone. Is this something a webhook like flowboost could help with?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Comparing and validating form data

Lots of ways to do this in JS but this FlowBoost payload will work fine:

let setOne = [{{lead.A Field}}, {{lead.Another Field}}, {{lead.Yet Another Field}}];
let setTwo = [{{lead.A Proxy Field}}, {{lead.Another Proxy Field}}, {{lead.Yet Another Proxy Field}}];

isMatch = Object.keys(setOne).every((key) => 
  setOne[key] === setTwo[key]
);

 

That’ll set isMatch to true if every value is identical in both lists.

 

For a looser comparison (so strings are case/accent-insensitive) you can use:

isLooseMatch = Object.keys(setOne).every((key) => 
  typeof setOne[key] == "string"  
    ? setOne[key].localeCompare(setTwo[key], undefined, { sensitivity : "base" }) == 0
    : setOne[key] === setTwo[key]
);

 

View solution in original post

2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Re: Comparing and validating form data

Sure, FlowBoost can easily do this. One of its raisons d'être, even!

 

I'll post a sample snippet later (as I'm on my phone and can't use the syntax highlighter) but it's as simple as JS ===.

SanfordWhiteman
Level 10 - Community Moderator

Re: Comparing and validating form data

Lots of ways to do this in JS but this FlowBoost payload will work fine:

let setOne = [{{lead.A Field}}, {{lead.Another Field}}, {{lead.Yet Another Field}}];
let setTwo = [{{lead.A Proxy Field}}, {{lead.Another Proxy Field}}, {{lead.Yet Another Proxy Field}}];

isMatch = Object.keys(setOne).every((key) => 
  setOne[key] === setTwo[key]
);

 

That’ll set isMatch to true if every value is identical in both lists.

 

For a looser comparison (so strings are case/accent-insensitive) you can use:

isLooseMatch = Object.keys(setOne).every((key) => 
  typeof setOne[key] == "string"  
    ? setOne[key].localeCompare(setTwo[key], undefined, { sensitivity : "base" }) == 0
    : setOne[key] === setTwo[key]
);