Skip to main content

The project is to import wifi data to Salesforce via API

 

The Objects involved are,

1. Wifi guest info  -  one of the fields is Contact with the data type Master-Detail relationship(Contact).

2. Contact

 

Use case: 

When data gets imported to Wifi guest info, Contact info needs to get imported  with the following fields: (first name + last name + email makes is a unique key)

 

Acceptance criteria: no duplicates should be imported into the Contact object

 

The issue is the import results in duplicate data. The vendor who is importing data is not successful in eliminating the dups.

 

Any thoughts/suggestions will be very helpful.

 

Thank you!

 

@* Sales Cloud - Best Practices *

2 个回答
  1. 2023年3月14日 16:27

    @Shanthi Palani you could use the Composite REST where the Contact Email would be a unique key in the PATCH method. BUT! This concept means you would have no duplicates in your system, otherwise the response would return all the matched records by the Email.

    Here is an example of the Composite request body:

    {

    "allOrNone" : true,

    "compositeRequest" : [

    {

    "method" : "PATCH",

    "url" : "/services/data/v57.0/sobjects/Contact/Email/email@test.com",

    "referenceId" : "refContact",

    "body" : { "LastName" : "BETA" }

    },

    {

    "method" : "POST",

    "url" : "/services/data/v57.0/sobjects/Wifi_Guest_Info__c",

    "referenceId" : "refWifiGuestInfo",

    "body" : {

    "Field1__c" : "Value1",

    "Field2__c" : "Value2",

    "Contact__c" : "@{refContact.Id"}

    }

    ]

    }

    As you could see, the Contact subrequest is using email value "email@test.com" as a unique key:

    • So when the 1st request is made and there is no such a Contact in the system -> the composite request would create the new Contact + Wifi Guest Info record;
    • And if there would be another Wifi Guest Info record creation attempt for the same Contact -> the system would just update the existing Contact (if needed) and would insert the new Wifi Guest Info record.

    Hope that helps!