Salesforce

How Do I Update and Upsert in Salesforce Using the setRefbyExternalId Function? (Magic xpi 4.13)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

How Do I Update and Upsert in Salesforce Using the setRefbyExternalId Function? (Magic xpi 4.13)

To update and upsert in Salesforce using the setRefbyExternalId function, follow these steps:

  1. Create a contact in Salesforce using Magic xpi. Every Salesforce contact has a lookup account field (named Account Name, as shown below).


    The Account Name in a contact's Edit mode is a lookup field:

  2. Go to Setup > App Setup > Customize > Accounts > Fields. In the following image, the account has an external ID field with the API name SLASerialNumber__c.

  3. To update the Contact “John Smith” field so that it will point to the Account NamePyramid Construction Inc.” field, but without knowing the Account ID, you can use the SLASerialNumber__c value. In this case, the value is 1981.

  4. When you update a contact in the Salesforce connector, the AccountId field appears in the Data Mapper. Since the contact's Account Name field is a lookup field, you can map the following details into the AccountId:

'setRefbyExternalId (Account, SLASerialNumber __c, 1981)'

During runtime, the value that will be inserted into the AccountId is the ID of the account whose SLA Serial Number is equal to 1981. If there is more than one account whose SLA Serial Number is set to 1981, the operation will fail.

The same procedure is also valid for the Upsert operation (the only difference is that in Upsert you need to specify the Upsert criteria) and for the Create operation (where you need to specify the Create operation's mandatory fields).

Reference
Attachment 
Attachment