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?
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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'}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.