How to Sync Statuses and Custom Fields Between GitHub and Salesforce

GitHub-to-SF-1911x1074

Organizations can sync data between GitHub and Salesforce in order to allow teams on both ends to collaborate easily and access vital data.

For this to happen, you’d need native or third-party solutions. I’ll show you how to sync statuses and custom fields between GitHub and Salesforce using Exalate

Status and Custom Field Update: GitHub to Salesforce Use Case

You can create a custom field in your Salesforce case to reflect data from a GitHub issue. These custom fields will reflect values from GitHub default fields. 

For this illustration, we want to fetch the ID and Status of a GitHub issue and make them appear in custom text fields on Salesforce. We’ll also discuss how to change the status of the Salesforce case based on the status of the GitHub issue. 

Here are the requirements and challenges:

Primary Requirements

  • Fetching the right API name from fields and entities on both sides.
  • Mapping the correct statuses on both Salesforce and GitHub.
  • Establishing sync rules for the incoming and outgoing data in custom fields. 
  • Setting triggers to automatically start a Salesforce GitHub integration.

Potential Challenges

  • Data transformation
  • Network timeouts 
  • Trigger configuration 
  • Accuracy of rules and mappings

How Exalate Syncs Statuses and Custom Fields Between GitHub and Salesforce

Exalate is a two-way integration solution that works with Zendesk, Azure DevOps, ServiceNow, Jira, Salesforce, GitHub, etc. 

Why Exalate? 

  • It supports trigger-based integration and bulk operations.
  • It provides an integration as a service (IaaS) option
  • It supports the synchronization of Salesforce and GitHub custom fields.
  • You can use its Groovy scripting engine for complex use cases.

How to Implement Exalate for Status and Custom Field Updates

First, install Exalate on both Salesforce and GitHub. Then, follow the instructions in this comprehensive guide to establish a connection between them.

Use the Script Mode—which allows for the advanced integration and scripting that this use case demands. 

Once the connection is set, open Exalate in Salesforce and go to the connection you want to edit. Click on the “Edit connection” icon. The process is similar on GitHub. 

If you prefer videos, watch this tutorial on how to implement the use case.

Under the “Rules” tab, you’ll see two options: 

  • Outgoing sync (on the GitHub side) refers to the data to be sent over to Salesforce. 
  • Incoming sync (on the Salesforce side) refers to the data to be received from the GitHub issue.

Enter the following code snippet into the Salesforce “Incoming sync” text area. 

entity.”GitHub_ID__c” = replica.key
entity.”GitHub_Status__c” = replica.status.name
Status sync in GitHub

The entity.”GitHub_ID__c” function points to the custom field name within the Salesforce case. The replica.key expression contains a payload of the GitHub issue key. 

The entity.”GitHub_Status__c” function points to the custom field name within the Salesforce case. The replica.status.name expression contains the payload name value of the GitHub issue status. 

If you want the Salesforce Case status to change automatically when you change the GitHub issue status, you need to map the statuses. In this case, enter the following snippet to the Salesforce “Incoming sync” text area.

def statusMap = [
          “New”         : “New”,
          “In Progress” : “Working”,
          “Done”        : “Escalated”
        ]
def remoteStatusName  = replica.status.name
statusName = statusMap[remoteStatusName]
entity.Status = statusName

Once done, click “Publish” to save the changes.

Next, go to “Triggers” and click “Create a trigger” to automate the sync.

Triggers in GitHub

Exalate for Salesforce uses the Salesforce Object Query Language and advanced search syntax to configure event triggers. So if you want to trigger the sync for any Salesforce case with the status “Working”, here is the code for it: 

Status = “Working”

Tick the “Activate trigger” checkbox and enter notes before clicking on “Add”. Your trigger is set.

Now head to your GitHub issue and drop a comment.

Comment sync

You can see the current status, comments, and issue ID. Now head back to Salesforce to see that the corresponding fields have been populated automatically.

Comment sync in Salesforce

Congratulations! You have now set rules and triggers to help you update statuses and sync custom Salesforce case fields with GitHub issues. 

Start monitoring things in order to adjust the rules according to the demands of specific projects and issues.

If you still have questions or want to see how Exalate is tailored to your specific use case, book a demo with one of our experts right away.

Recommended Reading:

Comments are closed.