# Confusion With Salesforce Composite API

**URL:** <https://connective.celigo.com/t/confusion-with-salesforce-composite-api/3209>\
**Category:** Integrator.io\
**Tags:** import, json, lookup, salesforce\
**Created:** [February 19, 2025, 5:49pm UTC](https://connective.celigo.com/t/confusion-with-salesforce-composite-api/3209 "2025-02-19T17:49:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![daveguderian](https://avatars.discourse-cdn.com/v4/letter/d/ce7236/32.png) [@daveguderian](https://connective.celigo.com/u/daveguderian)\
**Post date:** [February 19, 2025, 5:49pm UTC](https://connective.celigo.com/t/confusion-with-salesforce-composite-api/3209/1 "2025-02-19T17:49:27Z")

</div>

I will apologize in advance as this is a very lengthy post, but hopefully can help others if they are using the Composite SF API also!

I am using the SF Composite API option to insert/update records and am confused on the difference between using the "How can we find existing records" on the "Edit Import" screen vs that on the field mapping (more on that at the bottom of the post).

In my case, I will always have an account Id to match to an existing account, however, each contact may or may not have a contact Id. The contact Id is being retrieved from a previous lookup step. If there is a contact Id, then the import should update the existing contact with the fields outlined in the import mapping, but if there is not a contact Id, then the import should treat that as a new contact and import accordingly.

Can someone assist with helping me outline how my Insert/Update should work?

Current setup on the Import:

 ![image](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/e/ebc18ef4d9b2393e3f6ef5eb2d81348c2b9742bf.png)  
 ![The image shows a "Define lookup criteria" interface with search filters for "Account ID" and "Contact ID" being set to specific fields. (Captioned by AI)](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/f/f7347ab371e6de4666efe5dc591fdd072fe6dafc.png)

Input Sample Payload (this is just the Account and Contact portion):

```json
{
  "FormInformation": {
    "FormName": "CELIGOTESTCSNewDependentLayout",
    "SubmitDate": "2025-02-17T19:43:22.749Z",
    "CognitoFormId": "564-3",
    "FormURL": "https://www.cognitoforms.com/ClearwaterBenefits1/564/entries/3",
    "Status": "Submitted",
    "StatusReason": "Submitted",
    "EnrolledFrom": "Cognito"
  },
  "AccountInformation": {
    "AccountName": "PrimaryFirst PrimaryLast",
    "HealthCloudAccountId": "001Pn00000PGx76IAD",
    "PrimarySSN": "423-22-4223",
    "PrimaryDOB": "1986-10-31",
    "MobilePhoneNumber": "(241) 231-2322",
    "StreetAddress": "12345 Sesame Lane",
    "City": "Omaha",
    "State": "Nebraska",
    "ZipCode": "68116"
  },
  "ContactInformation": [
    {
      "FirstName": "PrimaryFirst",
      "LastName": "PrimaryLast",
      "MiddleInitial": "H",
      "Relationship": "Self",
      "DateOfBirth": "1986-10-31",
      "Gender": "Male",
      "SocialSecurityNumber": "111-22-3333",
      "TobaccoUser": "Yes",
      "Email": "test@test.com",
      "MobilePhoneNumber": "(241) 231-2322",
      "ContactId": "003Pn00000RH7UiIAL"
    },
    {
      "FirstName": "SpouseFirst",
      "LastName": "SpouseLast",
      "MiddleInitial": null,
      "Relationship": "Spouse",
      "DateOfBirth": "1979-12-20",
      "Gender": "Female",
      "SocialSecurityNumber": "444-55-6666",
      "TobaccoUser": "Yes",
      "Email": "test1@test.com",
      "MobilePhoneNumber": "(312) 312-3212",
      "ContactId": "003Pn00000RH7UiIBL"
    },
    {
      "FirstName": "Child1First",
      "LastName": "Child1Last",
      "MiddleInitial": null,
      "Relationship": "Child",
      "DateOfBirth": "2003-06-20",
      "Gender": "Female",
      "SocialSecurityNumber": "312-31-2321",
      "TobaccoUser": "No",
      "Email": null,
      "MobilePhoneNumber": null
    },
    {
      "FirstName": "Child2First",
      "LastName": "Child2Last",
      "MiddleInitial": null,
      "Relationship": "Child",
      "DateOfBirth": "2006-05-20",
      "Gender": "Male",
      "SocialSecurityNumber": "412-32-1321",
      "TobaccoUser": "No",
      "Email": null,
      "MobilePhoneNumber": null
    },
    {
      "FirstName": "Child3First",
      "LastName": "Child3Last",
      "MiddleInitial": null,
      "Relationship": "Child",
      "DateOfBirth": "2020-04-01",
      "Gender": "Male",
      "SocialSecurityNumber": "324-24-2432",
      "TobaccoUser": "No",
      "Email": null,
      "MobilePhoneNumber": null
    },
    {
      "FirstName": "Child4First",
      "LastName": "Child4Last",
      "MiddleInitial": null,
      "Relationship": "Child",
      "DateOfBirth": "2022-09-01",
      "Gender": "Female",
      "SocialSecurityNumber": "241-23-4123",
      "TobaccoUser": "No",
      "Email": null,
      "MobilePhoneNumber": null
    }
  ]
}

```

Sample Field Mappings:

 ![image](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/6/60ddd1c61b3992d2cea182adce3d9432d44b8e15.png)

Some of my confusion stems from this section of the help pages:

> **[Import data into Salesforce](https://docs.celigo.com/hc/en-us/articles/360052223752-Import-data-into-Salesforce#h_01HKMRZRFRW1BXKKXDJMZNPPZK)**
>
> This article examines common options when integrating with Salesforce as a destination app. 
> 
> For a full tutorial that retrieves Salesforce records, see Export data from Salesforce
> 
> For model integ...

If you navigate down to the Import Mapping section, it has some documentation around the Composite API and always performing a line ID lookup. Does this mean that I need to have a lookup for each field?

 ![image](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/2/238d2d93228894e7738642c4ab22c116de9034cd.png)

---

<div class="post-metadata">

**Author:** ![tylerlamparter](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/tylerlamparter/32/9204_2.png) [@tylerlamparter](https://connective.celigo.com/u/tylerlamparter)\
**Post date:** [February 19, 2025, 6:08pm UTC](https://connective.celigo.com/t/confusion-with-salesforce-composite-api/3209/2 "2025-02-19T18:08:31Z")

</div>

@daveguderian before I look at this, fyi that code blocks are under settings icon and can be used like this:

 ![The image shows a dropdown menu in a text editor, with an arrow pointing to the "Preformatted text" option. (Captioned by AI)](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/e/e5ce2d7074673049061f9b17b02dd5a6ab50b278.png)

```auto
{
  "FormInformation": {
    "FormName": "CELIGOTESTCSNewDependentLayout",
    "SubmitDate": "2025-02-17T19:43:22.749Z",
    "CognitoFormId": "564-3",
    "FormURL": "[Cognito Forms: Free Online Form Builder](https://www.cognitoforms.com/ClearwaterBenefits1/564/entries/3)",
    "Status": "Submitted",
    "StatusReason": "Submitted",
    "EnrolledFrom": "Cognito"
  }
}

```

---

<div class="post-metadata">

**Author:** ![daveguderian](https://avatars.discourse-cdn.com/v4/letter/d/ce7236/32.png) [@daveguderian](https://connective.celigo.com/u/daveguderian)\
**Post date:** [February 19, 2025, 7:35pm UTC](https://connective.celigo.com/t/confusion-with-salesforce-composite-api/3209/3 "2025-02-19T19:35:28Z")

</div>

@tylerlamparter - Thanks for that! I wasn't sure where that went, and I didn't want to screw up my long post accidentally by hitting something I didn't intend to. I'll be sure to use the preformatted text in the future!

---

<div class="post-metadata">

**Author:** ![tylerlamparter](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/tylerlamparter/32/9204_2.png) [@tylerlamparter](https://connective.celigo.com/u/tylerlamparter)\
**Post date:** [February 19, 2025, 7:49pm UTC](https://connective.celigo.com/t/confusion-with-salesforce-composite-api/3209/4 "2025-02-19T19:49:23Z")

</div>

> I am using the SF Composite API option to insert/update records and am confused on the difference between using the "How can we find existing records" on the "Edit Import" screen vs that on the field mapping (more on that at the bottom of the post).

The how to find existing records would be related only to the sObject you specified above. So you are telling us "how can we find an existing account to update and if no account is found with this criteria then we will make a new one".

> If you navigate down to the Import Mapping section, it has some documentation around the Composite API and always performing a line ID lookup. Does this mean that I need to have a lookup for each field?

This means you do a dynamic lookup for the related objects id (I think, I have not tried this 🙂 ):

 ![This image shows a software interface for mapping fields between HTTP and Salesforce records, with a settings panel open for configuring search options. (Captioned by AI)](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/4/438a562c2ae840db21c752e3a9702a6463f4fb03.png)
