Qlik Community

Knowledge

Search or browse our knowledge base to find answers to your questions ranging from account questions to troubleshooting error messages. The content is curated and updated by our global Support team

Announcements
CASE PORTAL: Inability to view all organizations' cases. We are investigating. Thank you for being so patient.

How to build an upsert (create or update) pattern

cancel
Showing results for 
Search instead for 
Did you mean: 
Marius_Nuca
Support
Support

How to build an upsert (create or update) pattern

A lot of use cases that appear when syncing objects between two platforms fall under the upsert category.

Let's take a practical example to make things more simple. Customer uses Zoho CRM and Salesforce platform and he wants to sync all his Zoho CRM contact objects to his Salesforce account. Issue is that currently he has some contacts present in both platforms and when he is doing the full sync he doesn't want any duplicates added in his Salesforce account.

Here is where an upsert pattern comes in. After getting all the contacts in Zoho we can use a search endpoint from the Salesforce platform to check if it already exists or not. Then a condition block is added to see if that search returned any results: if there are results in the history of the block, contact is already present on the platform and we need to update that result, otherwise a new contact has to be created.

Following is an image of how the integration flow should look like:

upsert overall appearance.PNG

For the update block we can use the contact id that was found with the search block. In most cases the search will return a list so update is usually done on the first search result returned like in the example image:

selecting the first id.PNG

Now, a small issue might appear for some platforms when using a search or filter block. Some of them, when no contact has been found, return an error and that would mean our integration would fail which we don't want. In order to avoid this we will need to change the "On error " selection on the search block to "Ignore - Continue blend and ignore errors".

ignore errors option.PNG

That way the integration will continue running until it finished iterating through all of the Zoho contacts.

Labels (1)
Version history
Last update:
‎2021-07-28 04:51 PM
Updated by: