Contact Encounter (POST)

Load details of contact encounters into the system.

Prerequisites 

  • This API must be used only for person account-enabled orgs.
  • Ensure that you have access to the Contact Encounter fields and the Contact Encounter Participants fields in your org.

Contact Tracing Encounters and Participants 

  • To create a new encounter, set the referenceID field to null.
  • To update an existing encounter with details of new encounter participants, pass the referenceID of the encounter in the payload.
  • A single payload can have a maximum of 5 encounters.
  • A single payload can have a maximum of 50 participants per encounter.
  • Encounter participants are not mandatory. If a participant is specified, the participant type is mandatory. If the participant type is set to lead, the participant’s first name and last name are mandatory.

Resource 

1/services/data/vXX.X/contact-tracing

Available Version 

49.0 and later

Authentication 

Replace {token} with the OAuth access token.

Authorization: Bearer {token}

The Lightning Platform REST API supports OAuth 2.0 (an open protocol to allow secure API authorization). See Authorize Apps with OAuth in Salesforce Help for more details.

Note

HTTP Methods 

POST

Request Body 

JSON Example

1{
2    contactTracingEncounters: [
3        {
4            "referenceId":"0haRM000000000BYAQ",
5            "name":"SF All Hands Q2"
6            "estimatedParticipantCount": 10,
7            "startDateTime" : "2020-06-20T00:00:00Z",
8            "duration": 12,
9            "description" : "held in SF tower",
10            "participants" : [
11                {
12                    "participantType": "lead",
13                    "recordTypeName": "triage",
14                    "startTime": "2020-06-20T00:00:00Z",
15                    "duration": 12,
16                    "firstName" : "Leo",
17                    "lastName" : "Machado",
18                    "age" : 24,
19                    "phoneNumber" : "24323322",
20                    "emailAddress" : "lee.lo@mail.com",
21                    "address":{
22                        "city":"Seattle",
23                        "state":"Washington",
24                        "country":"US",
25                        "postalCode":"11404",
26                        "street":"Richmond St"
27                    }
28                },
29                {
30                    "participantType": "patient"
31                    "referenceId":"001RM000004iUi8YAE",
32                    "sourceSystemId":"211453",
33                    "startTime": "2020-06-20T00:00:00Z",
34                    "duration": 10,
35                    "age" : 34
36                }
37            ],
38            "location" : {
39                "name":"Seattle County",
40                "description":"Gala event",
41                "latitude" : "47.6" ,
42                "longitude": "122.3",
43                "encounterAddress":{
44                        "city":"Seattle",
45                        "state":"Washington",
46                        "country":"US",
47                        "postalCode":"11404",
48                        "street":"Dutch St"
49                    }
50            }
51
52        }
53    ]
54
55}

Properties

NameTypeDescription
contactTracingEncounters.​referenceIdStringThe ID of an existing contact encounter record in the Salesforce system.
contactTracingEncounters.​nameStringRequired. The name for the encounter.
contactTracingEncounters.​estimatedParticipantCountIntegerThe estimated number of participants in the encounter.
contactTracingEncounters.​startDateTimeDateTimeRequired. The start date and time of the encounter. Must be in YYYY-MM-DDT HH:MM:SS format. For example, 2020-05-18T09:15:00.
contactTracingEncounters.​durationIntegerRequired. The duration of the encounter in minutes.
contactTracingEncounters.​descriptionStringThe description for the encounter.
contactTracingEncounters.​participantsListThe list of participants for the contact encounter. Each element in the list represents ContactEncounterParticipant. Valid values are:
  • lead
  • employee
  • patient

Note: Only one value is allowed.
contactTracingEncounters.​participants.participantTypeStringRequired. The encounter participant type. Valid values are:
  • Lead— A new lead is created with the specified participant record type. If the record type does not exist in the org, an error message is returned. If the record type is not provided n the payload, the default record type (triage) is used.
  • Employee— The system performs a lookup to the person account and the record type is ignored. This lookup can be done in the following ways:
    • Using the referenceId that corresponds to the Salesforce record ID.
    • Using sourceSystemId. For an employee, this ID is typically the employee ID or employee number. If a match is found, the contact encounter participant record is created with the contact field lookup pointing to the matched person account. If a match is not found, this record is rejected and an error message is provided in the response.
  • Patient—The system performs a lookup to the person account and the record type is ignored. This lookup can be done in the following ways:
    • Using the referenceId that corresponds to the Salesforce record ID.
    • Using sourceSystemId. For a patient, this ID is the patient ID from an external source system. If a match is found, the contact encounter participant record is created with the contact_id lookup pointing to the matched person account. If a match is not found, this record is rejected and an error message is provided in the response.

Note: Only one value is allowed.
contactTracingEncounters.​participants.referenceIdStringThe ID of an existing patient or employee record in the Salesforce system. If a payload has both the referenceID and the sourceSystemID, the referenceID is used for the patient or the employee lookup.
contactTracingEncounters.​participants.sourceSystemIdStringFor a patient, the patient ID from an external source system at participant level. For an employee, the employee number representing the employee record in the Salesforce or the external system. If a payload has both the referenceID and the sourceSystemID, the referenceID is used for the patient or employee lookup.
contactTracingEncounters.​participants.recordTypeNameStringThe name for the record type. The value for this field must be exactly the same as the label of the record type in the user interface. This field is used only when contactTracingEncounters.​participants.participantType is set to lead.
contactTracingEncounters.​participants.startTimeDateTimeThe time when the encounter started.
contactTracingEncounters.​participants.durationIntegerRequired. The duration of the encounter in minutes.
contactTracingEncounters.​participants.firstNameStringRequired. The first name of the participant. This field is used only when contactTracingEncounters.​participants.participantType is set to lead.
Note: If participants.referenceId is provided, this field is optional.
contactTracingEncounters.​participants.lastNameStringRequired. The last name of the encounter participant. This field is used only when contactTracingEncounters.​participants.participantType is set to lead.
Note: If participants.referenceId is provided, this field is optional.
contactTracingEncounters.​participants.ageIntegerThe age of the encounter participant.
contactTracingEncounters.​participants.phoneNumberStringThe phone number of the encounter participant. This field is used only when contactTracingEncounters.​participants.participantType is set to lead.
contactTracingEncounters.​participants.emailAddressStringThe email address of the encounter participant. This field is used only when contactTracingEncounters.​participants.participantType​ is set to lead.
contactTracingEncounters.​participants.addressStringThe address of the encounter participant. This field is used only when contactTracingEncounters.​participants.participantType ​is set to lead.
contactTracingEncounters.​participants.address.cityStringThe city of the encounter participant. This field is used only when contactTracingEncounters.​participants.participantType ​is set to lead.
contactTracingEncounters.​participants.address.stateStringThe state of the encounter participant. This field is used only when contactTracingEncounters.​participants.participantType ​is set to lead.
contactTracingEncounters.​participants.address.countryStringThe country of the encounter participant. This field is used only when contactTracingEncounters.​participants.participantType ​is set to lead.
contactTracingEncounters.​participants.address.postalCodeStringThe postal code of the encounter participant. This field is used only when contactTracingEncounters.​participants.participantType ​is set to lead.
contactTracingEncounters.​participants.address.streetStringThe street of the encounter participant. This field is used only when contactTracingEncounters.​participants.participantType ​is set to lead.
contactTracingEncounters.​locationObject (reference to location)Identifies the location of the encounter.
contactTracingEncounters.​location.nameStringRequired. The name of the location where the encounter took place. If the encounter location name already exists in the system, the existing location record is used and the following location fields are ignored:
  • contactTracingEncounters.​location.description
  • contactTracingEncounters.​location.latitude
  • contactTracingEncounters.​location.longitude
  • contactTracingEncounters.​location.encounteraddress.city
  • contactTracingEncounters.​location.encounteraddress.state
  • contactTracingEncounters.​location.encounteraddress.country
  • contactTracingEncounters.​location.encounteraddress.postalCode
  • contactTracingEncounters.​location.encounteraddress.street
contactTracingEncounters.​location.descriptionStringThe description of the location where the encounter took place.
contactTracingEncounters.​location.latitudeStringThe latitude coordinate of the location where the encounter took place.
contactTracingEncounters.​location.longitudeStringThe longitude coordinate of the location where the encounter took place.
contactTracingEncounters.​location.encounteraddress.cityStringThe city where the encounter took place.
contactTracingEncounters.​location.encounteraddress.stateStringThe state where the encounter took place.
contactTracingEncounters.​location.encounteraddress.countryStringThe country where the encounter took place.
contactTracingEncounters.​location.encounteraddress.postalCodeStringThe postal code of the location where the encounter took place.
contactTracingEncounters.​location.encounteraddress.streetStringThe street where the encounter took place.

Response Body 

JSON Example

1{
2  "encounters" : [ {
3    "created" : false,
4    "id" : "0haxx00000000rFAAQ",
5    "location" : null,
6    "participants" : [ {
7      "created" : true,
8      "employee" : null,
9      "errors" : null,
10      "id" : "0hbxx00000000G9AAI",
11      "lead" : {
12        "created" : true,
13        "id" : "00Qxx000002TST8EAO"
14      },
15      "patient" : null
16    }, {
17      "created" : true,
18      "employee" : null,
19      "errors" : null,
20      "id" : "0hbxx00000000GAAAY",
21      "lead" : {
22        "created" : true,
23        "id" : "00Qxx000002TST9EAO"
24      },
25      "patient" : null
26    }, {
27      "created" : true,
28      "employee" : null,
29      "errors" : null,
30      "id" : "0hbxx00000000GBAAY",
31      "lead" : null,
32      "patient" : {
33        "created" : false,
34        "id" : "001xx000003GZ6tAAG"
35      }
36    } ]
37  } ],
38  "errors" : null,
39  "status" : null,
40  "success" : true
41}