FlowBoost can check if a Data Value Change was a “real” change, or just a case change
Marketo uses exact string comparison (case-sensitive and accent-sensitive) to determine if fields have changed. Overall, this is good: otherwise, we’d never know if enrichment/normalization APIs were working.
Problem: changes to key fields like Email Address (which teeeeechnically is case-sensitive but must be treated as case-insensitive) might trigger alerts to sales or other high-priority actions. You don't want a false alarm just because someone decided to boomerize capitalize their email:
Solution; in modern JS, and therefore in FlowBoost, you can do string comparison at any level of sensitivity.
First, create a custom Email type field Previous Email Address. That's what we'll use to store the old value to compare to the new value to see if it was a "real" change at a business level.
Then create this FlowBoost ’hook and trigger it on Data Value Changes for Email:
let oldValue = {{lead.Previous Email Address}};
let newValue = {{lead.Email Address}};
let baseLetterComparator = Intl.Collator(undefined, { sensitivity: "base" } );
effectiveDataValueChange = baseLetterComparator.compare(oldValue, newValue) == 0 ? false : true;
previousEmailAddress = newValue;
That’ll return a JSON response like this:
{
"effectiveDataValueChange": true,
"previousEmailAddress": "SANDY+TEST@ExAmPlE.cOm"
}
Now you can trigger on Webhook is Called to check if the change was more significant than just case or accent (constrain on Response contains "effectiveDataValueChange": true
).
And in the webhook Response Mappings, map previousEmailAddress
to Previous Email Address. That way, after the comparison, the latest value is saved in Previous, ready for the next comparison.
How it works
To get a non-default[1] instance of Intl.Collator
, you pass in a locale (here undefined
to use the system locale, en-us
) and an options object (here { sensitivity: "base" }
.
The sensitivity
option indicates the most granular difference that’s considered significant. So sensitivity: "base"
means if and only if base letters (like a
and z
) are different, 2 characters are different. Other differences are not
(In contrast, sensitivity: "case"
would mean if case is different, the strings are different — which we don’t want. Yes, it’s confusing, and I find myself re-learning it from time to time!)
Notably, Intl.Collator.compare()
is a sorting function. It’s not exclusively a yes/no comparison. If compare()
returns 0
, the two strings would sort at the same position, i.e. are equivalent using the given collation. Perfect for this use case, even if it sounds a little strange.
Notes
[1] A default instance uses "sensitivity": "variant"
, which treats all possible differences as significant. Basically the same way Data Value Changes works, and what we’re avoiding.