The need: Raise incidents affecting assets held in a local Jira project

In this use case, a Jira Service Management portal is used to allow customers to raise incidents impacting assets. Such assets are held in a Jira project that stores asset records (issues) comprised of a number of attributes (fields), similarly to a “light-weight” CMDB (Configuration Management Database). For customers to raise incidents impacting these assets, fields fetching these assets need to be available in the  Jira Service Management portal.


Solution: Populate Connected items with asset types, asset names and asset status

Use Elements Connect to directly fetch asset types and asset names held in a Jira project by configuring a direct connection between Jira and… Jira! Also provide Jira agents with asset information such as the status of the asset.

For this use case, the following cascading connected items can be configured on a JSM portal :

  • Asset type, a select list that shows all the asset types available in the Jira asset inventory project

  • Asset name, a select list that shows all the assets assigned to the logged-in user which match the asset type selected

  • Asset status, a read only connected item that displays the status of the selected asset

Elements Connect in action

How to configure an asset type picker, asset picker and display the status on the asset selected

Prerequisites:

  • Have a Jira project configured in your Jira instance to hold your assets - in this tutorial, we will call the project “CMDB”

  • Have Elements Connect installed on your instance

Configuration steps

The configuration is done in 4 steps:

  1. Configure your project to hold your assets

  2. Create and configure the Jira datasource in Elements Connect

  3. Create and configure the Connected items in Elements Connect to retrieve asset types, asset names and asset statuses from the “asset inventory” project

  4. Associate the Connected items to a request type in the JSM portal


Steps

1 - Configure the “CMDB” project to hold your asset types and your assets

The first step is to configure the asset inventory project (in this use case, it is named “CMDB”) to hold asset types and asset records (issues). In order to do that, we will create new issue types called “ Asset type” and “Assets”. The issue type “Asset type” will be used to represent our asset types and the issue type “Asset” will represent our assets in the project.


Create issue types “Asset type” and “Asset”

  • From the CMDB project, go to the Project settings

  • Go to Issues and click “Types”

  • Under the Actions button, select “Edit issue types”

Project Settings - Edit issue types

  • Click “Add issue type”, create your Asset issue type and click “Add”

Project Settings - Add issue type

  • Add the “Asset type” issue type to the current scheme and click “Save”

  • Repeat the same operation for the issue type “Asset”.

  • Go back to your project


Create your issues

  • Create issues to represent your asset types by selecting the issue type “Asset type” as follows

Project - Create asset type issue

For the purpose of this tutorial, the following asset types are used:

Asset types

  • Now create issues to represent your assets by selecting the issue type “Asset” as follows

Project - Create asset issue

Repeat the operation as many times as necessary for each asset type you created.


Link your assets to their asset type

At this stage, you created your asset types (Laptop and Phone in this example) and your assets. The next step is to link your assets to their relevant asset type in order to create a parent-child relationship between them where the asset type is the parent and the asset is the child.

  • Open your “Asset type” issues and click the “Link issue” button

Asset types - Linked issues

Your CMDB project is now correctly configured and should roughly look like this:

Jira Asset inventory board

The next steps are to configure the connection to the Jira project in order to fetch asset types and assets and display them in Elements Connect connected items.

2 - Create the Jira datasource in Elements Connect

This tutorial uses the connection to the Jira REST API using basic authentication in order to fetch the asset types and assets of the CMDB project. Let’s see how to do this.

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

Access Elements Connect from Jira main page

The first step is to create a REST API datasource.

Refer to this tutorial to configure Jira as a datasource.



3 - Configuring the connected items 'Asset type', 'Asset name” & 'Status'

What is a Connected item? As our official documentation mentions, a Connected item can be seen as a kind of connected custom field.

In this tutorial, we are going to create 3 Connected items:

  • Asset type, a select list that shows all the asset types available in the Jira asset inventory project

  • Asset name, a select list that shows all the assets matching the asset type selected

  • Status, a read only connected item that displays the status of the selected asset


Asset type (10006)

Create one Connected item called “Asset type” of type Select list. Set Jira (or the name you gave to the previously configured datasource) as the Connected item datasource.

Jira - Asset type configuration

REST endpoint: /search?jql=project=CMDB and issuetype = "Asset type"

Location of the Connected item options in the response: issues

Template: ${row.fields.summary}


Asset name (10007)

Create one Connected item called “Asset name” of type Select list. This connected item will display the assets linked to the issue type selected in the “Asset type” connected item where the Assignee is the logged-in user.

Set Jira (or the name you gave to the previously configured datasource) as the Connected item datasource.

Jira - Asset name configuration


REST endpoint: /search?jql=project=CMDB AND issueType = Asset AND issue in linkedIssues ("$issue.connected_item_10044.key") AND assignee = "$currentUser.accountId"

Location of the Connected item options in the response: issues

Template: ${row.fields.summary}


Status

At last, create one Connected item called “Status” of type Read-only. This connected item will display the status of the asset selected in the “Asset name” connected item.

Jira - Status configuration

REST endpoint:

/issue/$issue.connected_item_10001.key


Template - Status

<#assign status = data.fields.status.name/>
<#assign style = ''/>
<#switch status>
  <#case "In Use">
    <#assign style= 'success'/>
    <#break>
  
  <#case "In Stock">
    <#assign style= 'new'/>
    <#break>
  
  <#case "Configuration ongoing">
    <#assign style= 'current'/>
    <#break>
  
  <#case "Repair ongoing">
    <#assign style= 'error'/>
    <#break>
    
  <#case "Returned">
    <#assign style= 'moved'/>
    <#break>
  <#default>
    <#assign style= 'moved'/>
</#switch>

<span class="aui-lozenge aui-lozenge-${style}">${data.fields.status.name}</span>
CODE



4 - Associate the Connected items to a request type in the JSM portal

Now that your connected items are configured properly, you can associated them to a request type in your Jira Service Management project.

  • Go to your Jira Service Management project administration, and find the Connected item section.

  • Add the three Connected items to the desired request type (for example: Report an incident)

  • Open the request type in the customer portal (you can use the button in the top right of your screen)

Elements Connect project admin - View form in portal


You can see your three connected items on the forms:

JSM form with connected items


Select an asset type, and then an asset name. The status of the asset selected automatically displays.

JSM form with filled connected items