How to compute Unified Data with Last ChangeUpdated 25/06/2020


Hull - Processor: Unified data via last change

The code below can be copied directly into a (User) Processor in Hull and configured via variables to unify attributes based on the last change of various input attributes. The unified attribute will be calculated based on the last change to any related input attribute. The code is also able to handle the unification of top-level attributes such as first_name and last_name to properly display that information in user profiles in Hull.

Example Scenarios

Fallback 1

Unified last_name (top-level attribute)

Assuming you have various systems such as Salesforce and Hubspot connected to Hull, incoming data is stored as grouped attributes, so you most likely have the following attributes on a user profile:

  • salesforce_lead.last_name
  • salesforce_contact.last_name
  • hubspot.last_name

Now your team decides to pick up that the information and since all sources are equal in priority use the value of the source which changed last determine the unified attribute. So if someone makes a change on the Salesforce Contact, this should update the current unified value in Hull. If a day later someone updates the Hubspot Contact, that value should update the unified attribute in Hull as well.

Now all you have to do is to create a new variable in the Settings tab of the Processor under Custom Variables to indicate that you want to apply a fallback strategy for the top-level attribute last_name. So you enter the key fallbacks_last__last_name and a value of salesforce_contact.last_name;salesforce_lead.last_name;hubspot.last_name;. That's it, now the Processor will execute the logic to unify the top-level attribute last_name for you.

Unified job_title

Assuming you have various systems such as Salesforce and Hubspot connected to Hull, incoming data is stored as grouped attributes, so you most likely have attributes similar to the following on a user profile:

  • salesforce_lead.title
  • salesforce_contact.title
  • hubspot.job_title

Now your team decides to pick up that the information and since all sources are equal in priority use the value of the source which changed last determine the unified attribute. So if someone makes a change on the Salesforce Contact, this should update the current unified value in Hull. If a day later someone updates the Hubspot Contact, that value should update the unified attribute in Hull as well.

Now all you have to do is to create a new variable in the Settings tab of the Processor under Custom Variables to indicate that you want to apply a fallback strategy for the unified attribute job_title. So you enter the key unified_last__job_title and a value of salesforce_contact.title;hubspot.job_title;salesforce_lead.title. That's it, now the Processor will execute the logic to unify the attribute job_title and store the output in a group called unified. To consolidate your systems, you should use in the outgoing data section of all connectors the attribute unified/job_title instead of a cross-reference mapping from a particular other source.

Configuration

Configuration is entirely done via variables in the Settings of the Processor. The keys of the variables define the type of unification:

  • keys following the convention fallbacks_last__<ATTRIBUTE_NAME> define top-level attribute unification; naturally there are only two values allowed for <ATTRIBUTE_NAME> which are first_name and last_name. It is not recommended to unify the email with that code even you can do it.
  • keys following the convention unified_last__<ATTRIBUTE_NAME> define grouped attribute unification; you can define any name that makes, but it is recommended to use a snake_cased attribute name.

The value for each variable takes an unordered list devided by semicolons. The code will parse that list and apply the first matching changed value as the value for the unified attribute.

Remarks

If you want to prioritize input attributes in a certain order you might want to check out the guide for priority rules here

You can also combine them into one Processor, to do so, copy all the function in the UTILITY FUNCTIONS block except splitVariableToList from this code into the corresponding block of the priority rules Gist. Then add everything from the YOUR LOGIC block into the corresponding block of the priority rules code.

The naming conventions for the variables are designed in a way they won't clash, so you can use both strategies for unification in one Processor.

Embedded content: https://gist.github.com/SMK1085/82a180848394768bc8744cafeeafbbfa