Storing issue object in a variable in automation

Allam Castillo May 22, 2024

Is it possible to use the create variable action in Jira to store the entire issue object? I've used variables before, but only for simple values (text, date, number). However, I have a use case where I would like to store the entire issue object so that I could later reference parts of it from the same variable.

Example
Create variable

Name: myIssue

value: {{issue}}

 

Then later on I would like to reference {{myIssue.summary}}

Is this possible? I tried it, it didn't work, but I'm unsure if it's a syntax problem, a variable scope problem, or if the functionality simply doesn't exist.

 

Thanks for any advice.

2 answers

1 accepted

2 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 23, 2024

Hi @Allam Castillo 

No, not with a variable as the Create Variable action stores text values.

Some possible work-arounds are:

  1. Instead of Create Variable, use Create Lookup Table as it can store object data.  For example, if you store your object in the value for a row with a key of myIssue, the attributes could be accessed with {{myTable.get("myIssue").summary}}
  2. When you use Create Variable, add field names and delimiters as text.  Later when using the variable, parse out the data using text functions.
  3. Using the Send Web Request action, call one of the Jira REST API functions to load your issue data, and then access the fields using the webresponse.

Kind regards,
Bill

Allam Castillo May 23, 2024

Using Create Lookup Table is a great work-around. Thank you very much

 

Kind regards

Allam C.

Like Bill Sheboy likes this
0 votes
Pavol Gočal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 22, 2024

Hello,

I'm not sure if this is possible.

What is your use case behind this? What do you want to achieve? Maybe we can find another solution to your use case. 

 

Allam Castillo May 23, 2024

Hi Pavol. 

Thank you for the quick reply. Here is a rundown of my scenario

Issue A is in project 1

Issue B is in project 2

Whenever Issue A goes through a specific transition, I want to modify the description of Issue B with several information from Issue A. For the exercise let's say I want to add 

  • IssueA.description
  • IssueA.lastComment
  • IssueA.customField1
  • IssueA.customField2

What I am currently doing is I have an automation setup that is triggered when Issue A goes through said transition, and then modify Issue B using a related issue branch. The problem is when I am in the branch, {{issue}} is actually referring to Issue B. 

 

My current solution is to use variables for each part of IssueA that I want to translate to Issue B. I just wanted to know if I could simply take the entire {{issue}} object and assign it to a variable instead of each piece.

 

Here are some images of my automation

 

2024-05-23 08_56_29-Rule builder - Automation - Customer Service Desk - Jira.png2024-05-23 08_57_35-Rule builder - Automation - Customer Service Desk - Jira.png

Allam Castillo May 23, 2024

Apologies

 

I forgot to mention that in this scenario, Issue A and Issue B have a specific relationship.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events