Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Auto link Insight object to issue

Wim Abts September 13, 2021

Hi,

We would like to add all info of our customers deployment in Insight Asset Management.
Then, when the customer creates JSD ticket, show the CMDB info related to this customer in the issue to the support agent.
We would link both using the 'Organisations' field, using the organisation ID.
In the issue I have a automatically filled customfield, called 'Organization ID' which contains the ID of the organisation linked to the issue.

In the CMDB we have Customers with an attribute 'Org_ID' that contains the same info.

How now show the Customer Insight Object in the issue?

I tried creating an Insight Custom Field and set the Filter Assign Scope to "objectType = Customer AND Customer.Org_ID = ${customfield_22901.label}" but this is not working.

2 answers

0 votes
Farhaad_n January 18, 2022

I want the exact things, did you find the solution? 

Wim Abts January 19, 2022

Hi,
To make it work with the organization field, we used an automation that executes a scriptrunner script after the creation.
After testing and extra requirement to make it work in non service desk projects that do not have organizations, we switched to using another custom field that we have and that has the same values as the Organizations.
This field was already in use and was mainly set-up to be able to us customers in gadgets on dashboards (which is not possible with the organizations field).
This custom field is automatically filled using a Scriptrunner listener that runs after the creation of a ticket and can be manually adjusted if needed (fex when a reporter belongs to 2 organizations).
We than have the assign scope in the Insight Custom Field as follows: 
objectType = Customers AND Name = ${customfield_19801.name}

0 votes
Julia Gracia September 16, 2021

Hi Wim,

I have a similar situation in my instance I resolve this adding a script into the workflow in the creation transition. I my example I use the reporter username but you could use the customfield_22901 

 

def customField =  ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_22901");
 
def value = (String)issue.getCustomFieldValue(customField);

 

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.event.type.EventDispatchOption;

/* Insight custom field to set */
CustomField insightCF = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(XXXX);

if (insightCF == null) {
return true;
}

/* Get Insight IQL Facade from plugin accessor */
Class iqlFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.IQLFacade");
def iqlFacade = ComponentAccessor.getOSGiComponentInstanceOfType(iqlFacadeClass);

/* Specify the schema id as well as the IQL that will fetch objects. In this case all objects with Name matching the valueCF, be sure to include " around value */
def objects = iqlFacade.findObjectsByIQLAndSchema(X, "YOUR IQL)");

if (!objects.isEmpty()) {
MutableIssue mi = (MutableIssue) issue;
mi.setCustomFieldValue(insightCF, objects);
ComponentAccessor.getIssueManager().updateIssue(currentUser, mi, EventDispatchOption.DO_NOT_DISPATCH, false);
}
return true;

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events