We have sent a reply to your gmail email address as per your request and are sending it here too.
Your usecase can be implemented within a few steps.
First, if there is no column that stores ERP account ID, it is required to create ID_Compte_Maestro__c field in the Salesforce Account object. Further in our our answer, we will use ID_Compte_Maestro__c column.
We would recommend making it external ID field in your Salesforce account, then importing a CSV file to Salesforce Account object and mapping accountID from ERP to it.
Next, a CSV file should be imported to Salesforce Contact object with the help of UPSERT operation. It would be necessary to check "Use External ID" option and select IDcontactMaestro__c field as an External ID. If IDcontactMaestro__c is not on the list of available columns, you need to make it external ID in your Salesforce account.
AccountId field from the Contact object should be mapped with a lookup mapping to TOPCRE field.
Then set lookup mapping for the AccountId column. Select Target Lookup mapping:
- For Lookup Object - select Account
- For Result Column - select Id
- For Lookup Key Column - select ID_Compte_Maestro__c
- For Column - select TOPCRE
- Click Options and select the "Set null when no match found" check box
IDcontactMaestro__c field should be mapped with a column mapping to CLIENT.CDCLI field.
Finally, a CSV file should be imported to Salesforce AccountContactRelation object with the help of INSERT operation. There are two required fields in this object: AccountId and ContactId. Here, for the field AccountId it is needed to use target lookup mapping where TOPCRE is compared with ID_Compte_Maestro__c field and for the field ContactId a target lookup mapping is used with CLIENT.CDCLI field being compared to IDcontactMaestro__c.
For ContactId that already have a record with some AccountId created automatically in AccountContactRelation an error will be shown and that is an expected result. For the same ContactId with another AccountId a new row will be inserted.
Should you have any questions, do not hesitate to contact us back.