Skip to main content
Skip table of contents

Get client data from Salesforce CRM into JSM requests

The need: Display customers' information coming from a remote CRM

It is common for companies to use a CRM system to manage customer data and interactions.
When customers submit a support request in Jira Service Management, it can be helpful to fill relevant information such as contracts, contacts or accounts. It results in easy tracking and resolution by agents.

To avoid data duplication, manual input errors and ensure that customer data is always up to date, it is important to link the CRM system with Jira. This integration can save time and resources, as it eliminates the need for manual data entry and updates between the two systems.

Integrating a CRM with JSM is an efficient way to manage customer requests while keeping customer data accurate and up to date.


Solution: Use Connected items fetching Salesforce data in JSM

You can either watch the video or follow the step by step tutorial. Please keep in mind that the video only shows Elements Connect configuration. If you need assistance in configuring Salesforce, please read the first configuration step.

Tutorial

Prerequisites:

  • Have Salesforce as your Customer Relationship Management tool (CRM)
  • Have Elements Connect installed on your instance

Configuration steps:

Configure an app in Salesforce

Steps to add a Connected application in Salesforce

Prefer a video? Follow along in our video tutorial How to create a connected app in Salesforce for Elements Connect for Jira 


Step 1: Log in to your Salesforce account.

Step 2: Navigate to the Salesforce Setup by clicking on the gear icon in the upper-right corner and selecting "Setup" from the dropdown menu.

Step 3: In the Setup page, search for "App Manager" in the quick find box and click on "App Manager" under the "Build" section.

Step 4: In the App Manager, click on the "New Connected App" button.

Step 5: Fill in the required information for the connected app:

  • Connected App Name: Provide a name for your app.
  • API Name: The API name will be auto-populated based on the connected app name.
  • Contact Email: Enter your email address.
  • Enable OAuth Settings: Check this option to enable OAuth for your app.

Step 6: Under the "API (Enable OAuth Settings)" section, configure the following settings:

  • Callback URL: Enter https://ecc.elements-apps.com/token/authorization-code/access-token 
  • Selected OAuth Scopes: Choose the required OAuth scopes based on the permissions your app needs (In this example, we select the “full” scope).
    Always make sure to have at least these permissions selected:
    • Manage user data via APIs (api)

    • Manage user data via Web browsers (web)

    • Perform requests at any time (refres_token, offline_access)

Step 7: Under the "Require Secret for Web Server Flow" section, you must enable Authorization Code and Credentials Flow.

Step 8: if you do not want to refresh your token manually, make sure refresh token policy is set on "Refresh token is valid until revoked"


Step 9: Click on the "Save" button to create the connected app.

Step 10: On the connected app detail page, note down the "Consumer Key" and "Consumer Secret" values. These will be used for authentication with Salesforce.


Congratulations! 
You have successfully created a connected app in Salesforce. You can now use the consumer key and consumer secret to integrate your app with Salesforce APIs and Jira using Elements Connect.

Configure a data source in Elements Connect


Make sure you have Elements Connect installed on your Jira instance.

→ Go to Elements Connect administration by clicking on “Apps”, then Elements Connect

Create a REST API data source
Click on “Create datasource” and select REST API.

Enter a name for your datasource, then configure the relevant fields:

If you are using a Salesforce sandbox environment, the Authentication URL and Access Token URL change. Please use the following:



Click on Get access token

You will be prompted to enter your Salesforce credentials and allow the app to communicate with Elements Connect

Once the access token status is valid ( VALID ACCESS TOKEN), you can save your data source.

Configure Connected items in Elements Connect

In this part, we will configure 2 dependent Connected items:

  • Accounts: A single select list that fetches every accounts from Salesforce and display their name
  • Contact opportunities: A read-only that displays dynamically every opportunities Amount and Name from the previously selected Account
Accounts

Fetch data from API

In the API request, write the following in the endpoint:

  • /services/data/v42.0/query?q=SELECT Account.id , Account.name FROM Contact

In the Data in API response, enter the following location:

  • records


Customize look & feel

The previous query’s response has the following structure:

Query's JSON response structure
CODE
{
    "totalSize": 26,
    "done": true,
    "records": [
        {
            "attributes": {
                "type": "Contact",
                "url": "/services/data/v42.0/sobjects/Contact/00309000005kzuYAAQ"
            },
            "Account": {
                "attributes": {
                    "type": "Account",
                    "url": "/services/data/v42.0/sobjects/Account/0010900000C0qVtAAJ"
                },
                "Id": "0010900000C0qVtAAJ",
                "Name": "Edge Communications"
            }
        },
        {
            "attributes": {
                "type": "Contact",
                "url": "/services/data/v42.0/sobjects/Contact/00309000005kzuZAAQ"
            },
            "Account": {
                "attributes": {
                    "type": "Account",
                    "url": "/services/data/v42.0/sobjects/Account/0010900000C0qVtAAJ"
                },
                "Id": "0010900000C0qVtAAJ",
                "Name": "Edge Communications"
            }
        },
        {
            "attributes": {
                "type": "Contact",
                "url": "/services/data/v42.0/sobjects/Contact/00309000005kzuaAAA"
            },
            "Account": {
                "attributes": {
                    "type": "Account",
                    "url": "/services/data/v42.0/sobjects/Account/0010900000C0qVuAAJ"
                },
                "Id": "0010900000C0qVuAAJ",
                "Name": "Burlington Textiles Corp of America"
            }
        }
    ]
}        

As we want to only display the names of Accounts, we configure our freemarker template accordingly:

  • ${row.Account.Name}

Contact opportunities

Fetch data from API

In the API request, write the following in the endpoint:

  • /services/data/v42.0/query?q=SELECT Opportunity.Id, Opportunity.Name, Opportunity.Amount FROM Opportunity, Opportunity.Account WHERE Account.id  = '$issue.connected_item_10024.Account.Id'


$issue.connected_item_10024.Account.Id is to be understood as followed: 

For a given issue, it will be replaced by the Account ID of the selected Account (which is the connected item with the ID 10024 in our case)


Customize look & feel

The previous query’s response has the following structure for a given account (number of records can change depending on the account)

Query's JSON response structure
CODE
{
    "totalSize": 10,
    "done": true,
    "records": [
        {
            "attributes": {
                "type": "Opportunity",
                "url": "/services/data/v42.0/sobjects/Opportunity/00609000006xhCuAAI"
            },
            "Id": "00609000006xhCuAAI",
            "Name": "United Oil Office Portable Generators",
            "Amount": 125000
        },
        {
            "attributes": {
                "type": "Opportunity",
                "url": "/services/data/v42.0/sobjects/Opportunity/00609000006xhCyAAI"
            },
            "Id": "00609000006xhCyAAI",
            "Name": "United Oil Refinery Generators",
            "Amount": 270000
        },
        {
            "attributes": {
                "type": "Opportunity",
                "url": "/services/data/v42.0/sobjects/Opportunity/00609000006xhCzAAI"
            },
            "Id": "00609000006xhCzAAI",
            "Name": "United Oil SLA",
            "Amount": 120000
        }
    ]
}

We want to display dynamically every opportunities for a given account in a table. As freemarker handles and interpret HTML, you can configure the template as the following:

Contact opportunities Freemarker template
CODE
<table class="aui">
  <thead>
    <tr>
      <th id="Amount"> Amount </th>
      <th id="Name"> Name </th>
    </tr> 
  </thead>
  <tbody>
    <#list data.records as record>
    <tr>
      <td>$${record.Amount}</td>
      <td><a href= "https://elements3-dev-ed.lightning.force.com/lightning/r/Opportunity/${record.Id}/view" target="_blank">${record.Name}</a></td>
    </tr>
    </#list>
  <tbody>
</table>

Associate to a project

You can now associate your newly created Connected items to a project and test them in real life!


With this tutorial using our Authorization code grant type feature, you can give access to external customer data stored in Salesforce automatically in Jira issues. Bring both tools closer together and decrease errors caused by manual entries.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.