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

How can one reach json content with smart values with Jira Automation on Server / DC

Christian Bär
Contributor
August 19, 2021

I would like to use the status category color of an issues status in an automation rule.

Interestingly {{issue.status.statusCategory}} results to this in the log:

StatusCategory{self='<base-url>/rest/api/2/statuscategory/4', id=4, key='indeterminate', colorName='yellow', name='In Arbeit'} 

But unfortunately it is not possible to get the colorName member. It'S an empty string if I use {{issue.status.statusCategory.colorName}}

Only key and name deliver the correct content. 

Is there any chance to get other items from those "json objects" with smart values?



2 answers

1 vote
Simmo
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 22, 2021

Hi @Christian Bär

I'm from the Cloud team, not the Server team. However, what I can see what the issue most likely is. We haven't exposed the ability to access the colorName field, only the name and key are accessible at the moment.

I'm afraid that this is beyond my control. I suggest that you open a support case and see what the server team can do. It shouldn't be a big job to open up access to the colorName field.

Cheers,

Simeon.

0 votes
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.
August 19, 2021

Hi @Christian Bär 

Full disclosure that I am using Jira Cloud, and not Server...

I find that some of the smart values can be dereferenced using dot-notation, while others need to be extracted using text/list functions, etc.  You could try that to see what is accessible.  Also, the exact path may be different to that field.  (Please see below.)

This could also be a difference in how that object renders in log versus what is available with smart values.  You may use the information in this how-to article to learn which smart values are available: https://support.atlassian.com/jira-software-cloud/docs/find-the-smart-value-for-a-field/

UPDATE: To save you some time, I do not think this will be possible with Jira Server using automation rules; you may confirm that with the support team.

I was able to get the color by first saving the statusCategory to a created variable, and then access the field with string functions.  This seems to indicate one or more of the values in that object is dynamically generated and so unavailable using the smart value syntax *unless* the statusCategory is captured first.  As created variables are not available in Jira Server that method won't help you.

 

Best regards,
Bill

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 19, 2021

Funny @Bill Sheboy - I was thinking the same thing - let's look at what the API has.

Thing is, it has does appear to have the field Christian is looking for!

"status": {
    "self": "https://jiradev.MYSITE.com:8443/rest/api/2/status/10604",
    "description": "RFC",
    "iconUrl": "https://jiradev.MYSITE.com:8443/images/icons/status_generic.gif",
    "name": "RFC",
    "id": "10604",
    "statusCategory": {
        "self": "https://jiradev.MYSITE.com:8443/rest/api/2/statuscategory/2",
        "id": 2,
        "key": "new",
        "colorName": "blue-gray",
        "name": "To Do"

    }

But yeah, I ran into the same thing as Christian. I could get key and name as smart values, but not colorName. Very odd.

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 19, 2021

Server doesn't have variables, but it does have issue properties. Alas, when I tried to set a property called "statusColor" to {{issue.status.statusCategory.colorName}}, it also came up blank. :-/

OH, I didn't try saving the whole object. Let's see... I tried setting an issue Property called statusCat. These all came up blank:

PropColor: {{issue.properties.statusCat.colorName}}
PropCatColor: {{issue.properties.statusCat.statusCategory.colorName}}
PropName: {{issue.properties.statusCat.name}}
PropCatName: {{issue.properties.statusCat.statusCategory.name}}

 But this "worked" in the same way the field value itself works:

Full prop: {{issue.properties.statusCat}}

Returned:

StatusCategory{self='https://jiradev.MYSITE.com:8443/rest/api/2/statuscategory/2', id=2, key='new', colorName='blue-gray', name='To Do'}
Very odd.
Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events