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,361,608
Community Members
 
Community Events
168
Community Groups

Insight automation troubleshoot - update object attribute when an inbound reference is added

Edited

Hi community

Using Jira Data Center v8.20.10.

Goal:
To connect assets with persons and have up to date statuses (e.g not in use, in use) for assets.

Situation:
I have a one schema and two object types - "Person" and "Laptop".
"Person" object type (and respective objects) have an attribute called "Laptop" (attribute type "Object" -> "Laptop")

1. Object "Human" (in object type "Person") is updated with an attribute called "Laptop" -> new value is  "Computer".
2. Object "Computer" in object type "Laptop" has now 1 inbound reference -> object "Human".
3. Object "Computer" has an attribute (type Status) called "Laptop status" and current value is "Not is use"
4. Now that "Computer" got an inbound reference, the attribute "Laptop status" for object "Computer" should be automatically updated and given a new value "In use"


So I created an automation (screenshot), but it does not seem to work. What am I missing? Could it be that the trigger is wrong (e.g adding new inbound reference does not count as "Object updated"?) or can anyone recommend a better/other way to solve this? 
Insight automation.jpg
Thanks 
Alice

 

1 answer

1 accepted

0 votes
Answer accepted

The issue with what you have is that the "Object Updated" event fires on the Human object. There is no visible change or event fired on the Computer object.

The "IF" block won't allow you to fetch another object. It's only meant as a filter for objects associated with the Trigger.

You have 2 options. 

1) Continue to use Object Updated trigger and write a groovy script to serve as the Action.

2) Use a Schedule Trigger with the following IQL:

objectType = Laptop and object having inR(objectType=Person) and "Laptop status" != "In use"

You can set your schedule fairly small (maybe 15 minutes). The vast majority of the time, the IQL will return zero results and no further actions will take place. When 1 or more Person has been updated in the last 15 minutes, then those will have their corresponding status updated.

In your Action block for the attribute value, just type "In use". No need for ${}.

You might also want a second automation to perform the reverse action

objectType = Laptop and object not having inR(objectType=Person) and "Laptop status" = "In use"

So that you can change the Laptop status from "In use" back to "Not in use"

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

An unofficial way to monitor a JSM mail handler for errors

...eturns true if any content is returned for the webResponse.body.data.first s...

717 views 3 20
Read article

Atlassian Community Events