Loading records of object having two lookup fields on the same object(Contact)

There is one object relationship. The object has two lookup relationship both on the Contact.
We are trying to load relationship record data and relate that record with both the contacts. We have external ids field created on Contacts which are being used to load the data. But they are not getting loaded.

When we pass salesforce id directly then the record gets created.

Relationship(Child)->Contact1(Parent), Contact2(Parent)

In the upsert snap, we are using contact1 field as the related object. And while mapping we are passing salesforce id of Contact2 field, but the record is not getting created.

If anyone has implemented similar kind of functionality please let me know the steps.


@prakarshjain510: Are you getting any error when the pipeline gets executed or does it run completely and after validating Salesforce, you observed that the records were not ingested?

I would like to know what is your validation step and does your setup in Salesforce accept the external ID? If need arises, we can hop on a quick call to understand your use case better.

There was no error shown in the pipelines. In the mapper snap, I can see the id is generated for the relationship object.

Pipeline created:

In the Salesforce Created output, this is what I am getting:

Yes, the Salesforce accepts External Id field. While inserting Contact, I am doing upsert based on External Id, and it is working fine.

I had created a similar pipeline, where a junction object was getting upserted. The difference was, the junction object was child to Account and Contact.

And in this case, the relationship object is child to two Contact lookup fields.

It would be really helpful if we can jump on a call to discuss this. Appreciate all the help. Thanks!

One more thing to add, the Salesforce Poller after Relationship Create is not giving any output. I added a Join snap after that just to check if I am getting any value in the left path of join, but I am not getting anything.

Hi @prakarshjain510,

Check if your last snap is set to Validate & Execute. That will result in the scenario above.

1 Like

Thanks @bojanvelevski
After adding validate and execute, I am getting the following error in the poller snap -

This is the relationship mapper:

Not sure, why this error is coming though, as in the Relationship Upsert Snap, I am using contact as the related object and the external id field created on the Contact object.


I was able to resolve the error.

Had to use the correct relationship field API Name which was something else and not Contact__r.

Thanks a lot for the help @bojanvelevski @darshthakkar

1 Like

Glad you were able to resolve the error. Yeah, it has happened with me before that I used a wrong mapping for salesforce fields.

Salesforce fields have a double underscore “__” and I was going ahead with a single “_”; that was not allowing me to ingest any values. Second time, I was trying to insert a name and salesforce could ONLY accept an ID for a given field, I’ve had my part of resolving those errors previously.

Rationale behind not highlighting these facts before was to check and validate if there were any erros in the pipeline design/development, the next step would anyway have been checking the mapping which you did so all good.