Compare data from diffrent sources

Hi,

I just found n8n and have started to explore it and so far it’s awesome :slight_smile:

I have been searching for a solution but I’m stuck so I hope you can help me :sweat:

I’m trying to synchronize user accounts between two different databases, but I’m having problems comparing the data to take the correct action (create or update).
My goal is to be able to:

  • Create users in the target.
  • Update the user’s information on the target.

The data I get with Rest API looks like this:
Source:


And the target looks like:


The matching key is “userPrincipalName” from the source and “Upn” in the target.

Hi @Cizco

Have you seen the merge node and what it can do? this should give you the option to add the data. and with the if node you should be able to check if an item already exists.
The SET node will be the node to use to reformat the data so all the fields have correct names and contents.

Hope this helps. If you have any further questions please ask of course. :slight_smile:

3 Likes

Hi @BramKn,

Yes, I’ve looked at the Merge node but I haven’t been getting it to work yet.
I’ve tried both “fixed” values:
image
And as an expression:

but the result is the same.

I’m trying to find out if a user exists in the Target system or not.

Hi @Cizco
Without the “” :wink:

1 Like

:man_facepalming:

Thanks a lot @BramKn

1 Like