Search

Upsert Record

Last Updated: Mar 8, 2023

Articles

Use this function to update a record with the given parameters if the external ID matches, or create a record if the external ID does not match.

Syntax

Upsert Record (token, username, password, SObject_type, name, site, phone)

Parameters

Input Parameter Name Description
token Token used to connect to particular Salesforce account
username Salesforce account username
password Salesforce account password
SObject_type Type of the record to upsert
external_id ID to be matched
name Name of the record
site Site of the record
phone Phone number of the record

To know more about token, click here.

Returns

Return Value Description
Output
  • On Success returns 1 | Record Upserted Successfully
  • On Failure returns 0 | Error Message

Sample

Upsert Record (ABCDCEF, john@gmail.com, pass@123, Account, XYZ, updated_record, http:// example.com, 1234567890)

  • Uses token ABCDCEF to connect to Salesforce with username updated_record and password pass@123, searches for the record with external ID XYZ.
    • If a match is found, updates the matched record of type Account with name john@gmail.com, site http:// example.com and phone number 1234567890.
    • If a match is not found, inserts a record of type Account with name john@gmail.com, site http:// example.com and phone number 1234567890.
  • Returns Record Upserted Successfully on the updating the record.

To view all the Salesforce functions, click here.

Did you find what you were looking for?