Consulting | Insight | 9 MIN READ

Automate Asset Management in Your Service Desk with Insight


With the help of Jira Service Desk, IT Support teams have been enabled to serve customers, internal and external, in a simple and efficient way. However, there are a number of functions that are not included in the basic setup, such as asset management and tracking. This is where Insight comes in. Insight asset management supports the management, tracking and structuring of objects as a complete CMDB in Jira and Jira Service Desk. This blog post is about automating the asset management provided by Insight.

Use Case: Order new hardware

A typical user scenario is that someone wants to order a new phone or computer (or any other piece of equipment):

2015-10-05 16_22_53-IT Support - Service Desk2

The user is met with this form:

2015-10-05 16_23_24-Hardware Order - IT Support - Service Desk

The user can select the type of hardware they need:

2015-10-05 16_23_39-Hardware Order - IT Support - Service Desk

The next field will update and allow the user to select from a list of phones (because the user chose Phone in the previous list):

2015-10-05 16_24_04-Hardware Order - IT Support - Service Desk

The last field will determine who will use this phone. Sometimes HR or a manager wants to order it for somebody else. In this case, I'm ordering this phone for myself:2015-10-05 16_24_26-Hardware Order - IT Support - Service Desk

The final result before I click Create looks like this:

2015-10-07 14_04_47-Clipboard

The IT Support Agent will see the new ticket and Approve the order if everything seems to be OK:

2015-10-07 14_29_46-[SPACE-120] Hardware Order - Riada Labs Support

When the order is approved a new object will be automatically created in Insight (through a Jira post-function) and added to the ticket. The IT Support Agent will be prompted to add more information through transition screens in Jira, and that information will then be added to the new object with the help of Insight Post-Functions:

2015-10-07 16_55_44-Done_  SPACE-120 - Riada Labs Support

When the issue is completed (ie. the user has received the hardware), the object will be updated with the information added above and connected to the user:

Hardware Order - Riada Labs Support

The user is happy with the new piece of hardware until disaster strikes and the screen stops working. What should the user do? Go back to the Support Desk and submit a Hardware Support Request:

2015-10-05 16_22_53-IT Support - Service Desk1

The user will first give a basic explanation to what the problem is. If you have connected Jira Service Desk to Confluence, the user might find some useful information in the documentation and avoid creating a ticket altogether, but for now let's find our new hardware and report the problem. Do note that thanks to Insight the user will only see the items that are connected to him/her:

2015-10-07 15_08_55-Hardware Support Request - IT Support - Service Desk

Once the ticket has been created, the status of the hardware item, in this case the phone, will automatically switch to "Support Requested":

2015-10-07 15_11_46-[SPACE-142] My screen is not working - Riada Labs Support

Once the support agent has fixed the issue, all he needs to do is to close the ticket; the phone will again automatically be back "In Service" and the support agent can get back to solving more issues:

2015-10-07 15_12_07-[SPACE-142] My screen is not working - Riada Labs Support

Automate with Insight Post-Functions

The way most of the functionality above is happening is through the Insight CMDB post-functions in Jira. Jira has a few post-functions (actions that happen after you transition an issue from one status to another), and Insight extends this functionality by adding the possibility to modify issues and objects after a transition. I am going to highlight a few of these transitions below, but this is just a selection, there is plenty more to find for those who take their time and experiment with the different Insight post-functions, see below for some examples:

2015-10-14 15_29_45-Transition_ Done - Riada Labs Support

Post-function example 1: Modify an object attribute based on another object

This post-function allows the modification of an object attribute based on an object selected in another custom field. In the example below, the Asset Location object selected in the custom field Asset Location will be set into the object of the issue in custom field New Hardware, in this example the new iPhone6 object.

2015-10-14 15_33_01-Update Workflow Transition Insight Post-Function Function - Riada Labs Support

Post-function example 2: Set an object attribute based on a custom field

This post-function is different from the case above, because it takes data from a (non-Insight) custom field and inserts it into the attribute of an Insight object. The custom field from which we are fetching our data is actually in the last field in the screenshot below. First we select the custom field where the object is chosen, and secondly we decide the attribute of that object that should receive the new value. The last field is a little strange as you see, ${customfield_11902}. It represents the value of the custom field whose id is 11902, in this example it's the Serial Number that was filled out. Another option is to write some text string or number to have that value populate the attribute of the object, but sometimes you want to use the dynamic value of another field.

2015-10-14 15_36_04-Update Workflow Transition Insight Post-Function Function - Riada Labs Support

Post function example 3: Create an object through a custom groovy script

This happens when a hardware order is approved, and it is a groovy script run in a post-function. For your convenience the code is available below, but with absolutely no guarantee that it will work for you. Note that some of the id-numbers in there are hard-coded and that you need to modify those for your specific instance.

[codesyntax lang="groovy" blockstate="collapsed"]

import com.atlassian.jira.issue.ModifiedValue;
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder;
import com.atlassian.jira.component.ComponentAccessor;
import java.util.ArrayList;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;

/* Get CustomFieldManager */
def cfManager = ComponentAccessor.getCustomFieldManager();

/* Get Insight Object Facade from plugin accessor */
Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("");
def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectFacadeClass);

/* Get Insight Object Type Facade from plugin accessor */
Class objectTypeFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("");
def objectTypeFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectTypeFacadeClass);

/* Get Insight Object Attribute Facade from plugin accessor */
Class objectTypeAttributeFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("");
def objectTypeAttributeFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectTypeAttributeFacadeClass);

/* Get the selected Phone Model Name */
def cfPhoneModel = cfManager.getCustomFieldObjectByName("Hardware Model");
def phoneModelValue = cfPhoneModel.getValue(issue);
def phoneModelName = phoneModelValue[0].getName();

def cfHardwareType = cfManager.getCustomFieldObjectByName("Hardware Type");
def hwTypeObject = cfHardwareType.getValue(issue);

def hwTypeId = hwTypeObject[0].getObjectAttributeBeans()[1].getObjectAttributeValueBeans()[0].getValue().toInteger();

/* The ID of the object type "Customer" is 1 in this example. The easiest way of finding the ID of an object type is to click at the object type in the object type tree and open up the web browser console to get the id that Insight uses to fetch objects. This will be easier to do in upcoming releases. */
def objectTypeCustomer = objectTypeFacade.loadObjectTypeBean(hwTypeId, null);

/* Create a new unsaved object bean */
def newObjectBean = objectTypeCustomer.createObjectBean();

/* Set up the attribute list */
def objectAttributeBeans = new ArrayList();

if(hwTypeId == 128){
attributeNo = 580;
attributeNo = 601;

/* Set the name of the customer */
def nameObjectTypeAttributeBean = objectTypeAttributeFacade.loadObjectTypeAttributeBean(attributeNo); // 1 is the ID of the object type attribute "Name"
def nameObjectAttributeBean = newObjectBean.createObjectAttributeBean(nameObjectTypeAttributeBean); // This is the name object attribute for the new object
def nameObjectAttributeValueBean = nameObjectAttributeBean.createObjectAttributeValueBean(); // This is the actual value of the attribute
nameObjectAttributeValueBean.setTextShortValue(phoneModelName);// Set the name

def values = nameObjectAttributeBean.getObjectAttributeValueBeans();
values.add(nameObjectAttributeValueBean); // Add the value to the object attribute
objectAttributeBeans.add(nameObjectAttributeBean); // Add to the list of object attributes

/* Set all object attributes to the object */

/* Store the object into Insight. The new ObjectBean will be updated with an unique ID */
try {
newObjectBean = objectFacade.storeObjectBean(newObjectBean);
} catch (Exception vie) {
log.warn("Could not create issue due to validation exception:" + vie.getMessage());

def newKey = newObjectBean.getObjectKey();
def hwCF = cfManager.getCustomFieldObjectByName("New Hardware");
hwCF.updateValue(null, issue, new ModifiedValue(null, [newObjectBean]), new DefaultIssueChangeHolder());

log.warn("newObjectBean: " + newObjectBean);
/* Done! :) */



With the help of Insight and its post-functions, your Support Agents can focus on solving issues. Thanks to the Insight custom fields, users can find their own assets immediately, which reduces the complexity both for end-users and service agents. Try out the Insight post-functions or ask Riada for customized solutions using Insight and Jira Service Desk!


Try Insight




Other blog posts by Sana:

Estimate your sub-tasks in Jira Agile!

Originally published Oct 7, 2015 10:56:01 AM