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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,749
Community Members
 
Community Events
176
Community Groups

Concatenate two attributes in an automation

Edited

screenshot.png

 

Unlike the following thread: https://community.atlassian.com/t5/Marketplace-Apps-Integrations/Set-Insight-Automation-to-Concatenate-two-Attributes-when-an/qaq-p/1489152 when I'm trying to save my automation I have the following error :


Error

An error occurred when updating the rule. Please try again and report the problem if it continues.

 

My goal is to standardize by automation all the name of the object type "License (per user)" by concatening the two value : License and Username.

 

Environment

Jira Service Management 4.20.1 on premises

 

I'd appreciate any help, thanks in advance !

3 answers

1 accepted

0 votes
Answer accepted

I finally resolved my issue, I created a new automation as follow : 

Screenshot 2022-02-01 182100.png

and created the following Groovy script using ScriptRunner plugins:


import com.atlassian.jira.component.ComponentAccessor;

Class objectFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade");
Class objectTypeFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectTypeFacade");

def objectTypeFacade = ComponentAccessor.getOSGiComponentInstanceOfType(objectTypeFacadeClass);
def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade"));
def objectTypeAttributeFacade = ComponentAccessor.getOSGiComponentInstanceOfType(ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectTypeAttributeFacade"));
def objectAttributeBeanFactory = ComponentAccessor.getOSGiComponentInstanceOfType(ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.services.model.factory.ObjectAttributeBeanFactory"));

def objectTypeAttributeBean = objectTypeAttributeFacade.loadObjectTypeAttributeBean(1919).createMutable() //Get Name object based on ID attribute

//log.info(object.getObjectAttributeBeans().toString());

def attributes = object.getObjectAttributeBeans();
attributes.each{attribute ->
def type;
try {
type = objectTypeAttributeFacade.loadObjectTypeAttributeBean(attribute.getObjectTypeAttributeId());
} catch (Exception ee) {
log.warn("Could not load objectdue to validation exception:" + ee.getMessage());
}

if (type != null && "Software".equals(type.getName())){
license = objectFacade.loadObjectBean(attribute.getObjectAttributeValueBeans()[0].getValue().intValue()).getName();
}
if (type != null && "Username".equals(type.getName())){
username = attribute.getObjectAttributeValueBeans()[0].getValue();
}
}

def newname = username + ' - ' + license ;


/* Create the new attribute bean based on the value */
def newObjectAttributeBean = objectAttributeBeanFactory.createObjectAttributeBeanForObject(object, objectTypeAttributeBean, newname);
/* Load the attribute bean */
def objectAttributeBean = objectFacade.loadObjectAttributeBean(object.getId(), objectTypeAttributeBean.getId());
if (objectAttributeBean != null) {
/* If attribute exist reuse the old id for the new attribute */
newObjectAttributeBean.setId(objectAttributeBean.getId());
}
/* Store the object attribute into Insight. */
try {
objectTypeAttributeBean = objectFacade.storeObjectAttributeBean(newObjectAttributeBean);
} catch (Exception vie) {
log.warn("Could not update object attribute due to validation exception:" + vie.getMessage());
}

Hope it can help someone :).

Topic resolved on my end.

I tried opening the Developer tools to troubleshoot the issueScreenshot 2022-01-17 135205.png

The last cookie have the following information : "The cookie was blocked because neither did the request URL's domain exactly match the cookie's domain, nor was the request URL's domain a subdomain of the cookie's Domain attribute value"

As I was in incognito mode to login as administrator, I tried to follow that link solution https://confluence.atlassian.com/jirakb/where-are-the-insight-logs-for-data-center-installations-1040617518.html 

 

Unsuccessful so far.

0 votes
John Funk Community Leader Jan 13, 2022

Hi Yannick,

I don't see any problem with the syntax, but I don't use Jira Server either. I do know that would probably work if you were using Automation for Jira (there's a free and paid add-on) as I do that with Jira Cloud. 

Thanks for your answer, I'm using the free Automation included in Insight.

John Funk Community Leader Jan 17, 2022

I would suggest creating your rule using automation for Jira instead of the built in JWM automation. 

Like lemoi likes this

I checked Automation and Project Automation, both of them do not offer option related to Insight, neither in condition nor action offered. I guess that's a feature only available for Jira Cloud ?Screenshot 2022-01-18 152429.png

John Funk Community Leader Jan 18, 2022

Looks like that is the case. Are you using the Paid Automation Pro versioin? 

I'm using the Automation for Jira version 7.4.0Screenshot 2022-01-19 134716.png

John Funk Community Leader Jan 19, 2022

Yeah, looks like it is not possible.  :-(

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events