Hello,
I’d like to set up a Jira automation rule to be triggered upon a change to issue related scenarios.
If I understand correctly, the smart value for this is {{issue.properties.assertthat-scenarios.total}}.
However, I’m unable to use this field in “Field value changed” trigger, I can only select from the list of the drop down values.
If there is a way to do it, then my second question would be: how can we set up the rule action to display the Acceptance Tests section for issues where {{issue.properties.assertthat-scenarios.total}} > 0 and hide it when {{issue.properties.assertthat-scenarios.total}} == 0?
I found that the Acceptance Tests section can be hidden/exposed using "https://[domain].atlassian.net/rest/api/2/issue/[id]/properties/com.assertthat.jira.bdd_assertthat-bdd-new-issue-left-panel"
(DELETE for hiding or PUT with payload: {“added”:“com.assertthat.jira.bdd_assertthat-bdd-new-issue-left-panel”} for exposing), but I wonder if there is a way to use Jira Automation rules for this purpose.
Appreciate your advise.
Katya.
Hi @Katya -- Welcome to the Atlassian Community!
The Issue Updated trigger will not fire for a change to an issue's entity properties, and there is no built-in automation rule trigger for such properties.
As a workaround, a webhook may be used:
Kind regards,
Bill
Many thanks @Bill Sheboy the webhook seems to be the answer!
The action that should run based on this trigger is a bit complex and I wonder if Jira automation is even intended to handle such flows:
Determine issue tests presence
Determine Tests section visibility status
if tests present && section invisible {
expose Tests section
} else if tests not present && section visible
hide Tests section
}
Determine issue tests presence
curl -w "%{http_code}" -X GET -H "Content-Type: application/json" https://[domain].atlassian.net/rest/api/2/issue/[id]/properties/assertthat-scenarios
200 -> present
404 -> not present
Determine Tests section visibility status
curl -w "%{http_code}" -X GET -H "Content-Type: application/json" https://[domain].atlassian.net/rest/api/2/issue/[id]/properties/com.assertthat.jira.bdd_assertthat-bdd-new-issue-left-panel
200 -> visible
404 -> hidden
Expose Tests section:
curl -w "%{http_code}" -X PUT -H "Content-Type: application/json" -d '{"added":"com.assertthat.jira.bdd_assertthat-bdd-new-issue-left-panel"}' https://[domain].atlassian.net/rest/api/2/issue/[id]/properties/com.assertthat.jira.bdd_assertthat-bdd-new-issue-left-panel
Hide Tests section:
curl -w "%{http_code}" -X DELETE -H "Content-Type: application/json" https://[domain].atlassian.net/rest/api/2/issue/[id]/properties/com.assertthat.jira.bdd_assertthat-bdd-new-issue-left-panel
I couldn't find any embedded action to get/set the above other than using Jira API and I'm also not quite sure where in the rule I can place the first 2 API calls that determine the condition.
Am I trying to abuse the tool? :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
First to your last question: if you are doing something not permitted (or exceeding the service limits or usage limits) for rules, that will likely be detected and the rules halted...perhaps for your entire site!
However, based on what you describe:
And to learn more about calling a REST API endpoint from a rule with the Send Web Request action, please see this article:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am unclear what those last two calls do. Are they toggling a setting to impact the UX or something else?
Correct, they expand or hide one of the UI sections of an issue.
Many thanks for your help! I'll take it from here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Katya
welcome to the Atlassian Community.
It looks like the trigger you want to create is not possible. Why? Based on the information you've provided, it looks like the data is stored within an issue property (issue.properties.assertthat-scenarios) instead of an actual field. The Field value changed trigger works afaik only for actual fields.
Having said that, it seems that these properties are added by the AssertThat app. Why don't you reach out to their support and see if they can help you solving your use case?
Cheers,
Matthias.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you @Matthias Gaiser _K15t_
I contacted AssertThat support with the same question however while waiting for their response I thought that I might get insights about possible workarounds for using issue properties in Field value changed trigger in this community too.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Katya
We cannot use issue property with automation. Automation doesn't have any way to read that for the moment.
You can do something as mentioned here:
Read the issue property and save it to a variable.
But the rule must be Manual.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you @Aaron Pavez _ServiceRocket_
Actually what I'm trying to do is to trigger an update of ANY issue upon a change of {{issue.properties.assertthat-scenarios.total}} of that issue by setting the value of that property to some custom field of the same issue.
I am able to set the property into the custom field by using the Edit issue action, selecting the custom field from the drop down and setting it to {{issue.properties.assertthat-scenarios.total}}. This part works.
What I'm missing is which trigger should be used to fire the rule on an issue when its {{issue.properties.assertthat-scenarios.total}} gets changed.
I read the answers in the link you sent however I'm not sure which of them you suggested to follow.
Also, when you say that the rule must be manual, do you mean that it should be triggered manually for every issue I want to apply it to?
Thank you for clarifying!
Katya.
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.