Salesforce back-tagging?

  • 24 January 2023
  • 4 replies
  • 101 views

Badge
  • Friendly Neighbor
  • 1 reply

Following up from the first AMA - Bryce could you please elaborate on the Salesforce back-tagging you mentioned on the call? @bryce.coleman 


4 replies

Userlevel 1
Badge +2

Of course @Kyle !  By back tagging do you mean how do you update a Sobject in Salesforce using a workflow action? If you have any. more details to share please do so I can give you the right approach. 

Badge

Hi @bryce.coleman - Yes, exactly, if we make an update in Kustomer, how do we reflect that back on the SFDC side? We currently are using Zapier to send the inbound ‘project’ objects into Kustomer, and updates made to the ‘Customer’ record in SFDC all back into Kustomer. Thanks! 

Userlevel 1
Badge +2

Thanks @Kyle !

There are a few things you can do when it comes to updating objects in Salesforce. Remember that the prerequisite to updating objects is installing the Salesforce app and connecting your Salesforce instance to Kustomer. You can find more about doing that here: https://help.kustomer.com/en_us/integrate-with-salesforce-H1XUojR7d/

In order to update objects in Salesforce, the Kustomer Salesforce app needs some way to identify the Salesforce object you want to update. This can either be done by using an externalId or by using the sobjectId. The configuration is slightly different but I’ll cover both below. Keep in mind that the only way to update sobjects in Salesforce is through an action step in a Workflow. 

Using an externalId
If you want to use externalId you will need to create a field for the Salesforce object and Select the “Set this field as the unique record identifier from an external system“ option. More about how to do that can be found here: https://help.salesforce.com/s/articleView?id=000383278&type=1

Once you’ve created that field in Salesforce, you need to create a workflow and a workflow action where the Action App is Kustomer and the Action Event is Command Run By Name. The name of the command is kustomer_salesforce.app.kustomer.kustomer_salesforce.commands.upsert-with-external-id

You’ll then need to fill out the Body and the UrlArgs sections of that workflow action. The Args and Headers can be left blank.

For the Body, you’ll need the API name of each field that you want to update on the object. You can find the API name if you navigate to the Object manager in Salesforce, click on an object, and Select “Fields & Relationships. The middle column has a field name which you can copy and paste. Here’s an example of a Body that is updating the Name, Account Owner, and a custom notes field on an Account. Please note that this must be in JSON format:

{

"Name": "Acme Enterprises",

"OwnerId": "001311111ijQTD",

"Notes__c": "These are the notes for this account."

}


For the UrlArgs, you’ll need to specify the API version you are using, the name of the Sobject you are updating, the API name of the external Id field you want to update (which you can find in the Object manager under Fields & Relationships like I mentioned previously), and the externalId of that field (in other words, the value that should be used to populate the externalIdAttribute).

{

  "version": "v42.0",

  "sobject": "Account",

  "externalIdAttribute": "K_Account_status__c",

  "externalId": "{{steps.O4y8E6HjS.custaccount_status}}"

}


Once the action fires, it will output an error or a success. Like an API call in a workflow, the action won’t stop or log an error on the workflow. I’d recommend that you branch the workflow to capture any errors and send off an email, create a note on a conversation, or even send the failure and any details to Slack. 

Using an sobjectId
Using an sobjectId follows most of the same process. First, the Name field of the Command Run By Name Action Event is:

kustomer_salesforce.app.kustomer.kustomer_salesforce.commands.update-sobject

The body will still need to be a JSON formatted object containing the fields and values you want updated.

However, the UrlArgs will be slightly different. You’ll now need to include the version, the name of the sobject you want updated, and the id of that sobject.

n the JSON example below, you’ll notice that I’m referencing an id of an sobject that was returned from using a Kustomer Salesforce SOQL action. In my example workflow, I’m looking up the Account by searching for accounts that have a specific custom field. The SOQL string for the workflow action looks like this:

SELECT Id FROM Account where custom_field__c = ‘custom_field_value_goes_here'

You may also have the Sobject Id stored somewhere on a customer or company profile in Kustomer that you can lookup in a workflow action and reference in the sobjectId field for the UrlArgs section.

Once you have the mapping for referencing the sobjectId, you can reference it with /# or surrounded by {{}}

Here’s an example of UrlArgs needed to update an Account.

{

  "version": "v42.0",

  "sobject": "Account",

  "sobjectId": "{{steps.EtW8vxKnG.response.body.records.0.Id}}"

}


I hope this helps you better connect the your two systems and make it easier for your teams to work in Kustomer. Let me know if you have any follow up questions.

Userlevel 1
Badge +2

Hi @Kyle Just wanted to check back in to see if you had any other questions. 

Reply