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,298,102
Community Members
 
Community Events
165
Community Groups

Automation rule on referenced Insight objects

On my issue type, I created a custom field to reference Insight objects.

When I update that issue field (when I add a reference to an Insight object) I want to automate the value of an attribute of the referenced Insight object.

My Insight object has an attribute called "Stock" and I would like to update that value to its own value, minus 1.

That is : my Insight object has a "Stock" value of 10. When I reference this object on my issue, I want to update that stock value to 10-1 (9).

image.png

The automation rule gets triggered, but the value of Stock becomes -1 instead of 9. I bet the problem is with "object.Stock". What am I doing wrong?

2 answers

1 accepted

1 vote
Answer accepted

For the sake of completion, with the help of Atlassian support, I was able to generate the rule. I needed a Global Automation rule with the following settings:

  • When: Field value changed
    • Fields to monitor for changes: [Insight object field] 
    • Change type: Value added
  • Then: Create variable
    • Variable name: addedValues
    • Smart value: {{#addedfieldChange.values}}"{{.}}"{{^last}},{{/}}{{/}}
  • Branch on IQL
    • Schema: [Insight object schema]
    • Query: Name IN ({{addedValues}})
  • Then: Create variable
    • Variable name: stock
    • Smart value: {{object.Stock}}
  • And: Edit object attributes
    • Attribute: Stock
    • Value: {{#=}}{{stock}} - 1{{/}}

I created a reverse rule to increment the Stock value by 1 when an Insight object is removed from my field as well. It is basically the same rule but with {{#deletedfieldChange.values}} when "Change type" is "Value deleted".

It works as expected, when one (or more) Insight object(s) are added/removed from the field.

0 votes
Gaurav Community Leader Apr 26, 2022

Hello @Arnaud Marquis 

This is an interesting use case. I have done something similar previously, but I was mainly extracting the data from the Insight schemas.

Looking at the rule, I think it is not able to point/ gather the exact 'Stock'. So the question is stock for what?

I believe you would have some other Custom Field where you would be storing the item whose stock would need to be depleted. Replace the word 'object' with that field name and try. It should work.

Please find below the screenshot of my implementation. Kindly accept the answer if this helps.

Regards,

GG

Insight Object.png

@Gaurav thanks for your answer.

So the question is stock for what? - Stock (which is a custom Insight object attribute) of that specific referenced object. As I said, it "works" as it updates the stock value of the Insight object I am after. Just not with the right value.

I believe you would have some other Custom Field where you would be storing the item whose stock would need to be depleted. Replace the word 'object' with that field name and try. - No, there is no additional custom field. Just the attribute.

Suggest an answer

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

Coming Soon: Insight Changing to Assets

The 2020 acquisition of Mindville added powerful asset and configuration management capabilities to Jira Service Management in the form of Insight. Following the completion of that integration, custo...

245 views 1 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you