Search

Upsert Record

Last Updated: Nov 4, 2020

Articles

Use this function to update a record 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

Returns

Return Value Description
Output
  • On Success: 1, Record Upserted Successfully
  • On Failure: 0, Error Message

Sample

Upsert Record (ABCDCEF, new_user, pass@123, manager, XYZ, John, http:// example.com, 1234567890)

  • Uses the token ‘ABCDCEF’ to connect to the salesforce with username ‘new_user’ and password ‘pass@123’, searches for the record with external ID ‘XYZ’.
    • Updates the record of type ‘manager’ with name ‘John’, site ‘http:// example.com’ and phone number ‘1234567890’ if a match is found.
    • If a match is not found, inserts a record of type ‘manager’ with name ‘John’, 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?