Hello all,
I'm having a very frustrating time trying to figure out the correct way to create an Automation rule to add a specific component to a new issue. The test in English: When an issue is created, if the Component field is empty or if the Component field does not contain "WDQ Post Release", add the Component "WDQ Post Release to the Component field.
Seems simple. My JQL query is pretty basic:
component not in ("WDQ Post Release") or component is EMPTY
I tested the search filter in JIRA and it works great. I plug it into a project rule and it doesn't work. I get partial success if I break it into two conditions, so this is my rule right now. The first if/then works, the second does nothing.
WHEN: Issue created
IF: Issue matches JQL
component is EMPTY
THEN: Edit issue fields
set Component/s to "WDQ Post Release"
IF: Issue matches JQL
component not in ("WDQ Post Release")
THEN: Edit issue fields
Advanced
{
"update": {
"components": [
{
"add": [{"name": "WDQ Post Release"}]
}
]
}
}
The firsl if/then works fine, the second one does nothing.
I guess my post is too long, I can't see the bottom lines to correct it. :(
Any way, if there are no Components it reads the first If/Then and adds the component I want. If it is not empty but does not contain the value I want, it ignores the advanced rule and does nothing. How can I fix this to work properly?
Thanks!
Mike Thompson
JIRA Administrator
Copyright Clearance Center
Hey there Michael,
For matching on multiple if-conditions, you'll need to put conditions into individual "Branch" blocks on the "Current issue".
See https://codebarrel.atlassian.net/wiki/spaces/AUTO4J/pages/54100588/How+can+I+run+a+different+action+when+a+condition+doesn+t+match+if+else+branch for more info on this
Cheers,
Mark C
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Mark, but ultimately what I really want is to combine the JQL so that I have one statement:
component is EMPTY OR component not in ("WDQ Post Release")
Then just add the component. The problem is that if I combine the queries neither condition works and nothing is added. Checking the audit logs for both possible conditions (no component or a different component), I see "Some Errors":
Could not find valid 'id' or 'name' in component object. (components)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That should really work. You shouldn't need to use the "Advanced" section, which seems to be where the error is coming from, (make sure that is cleared) and just set the Components field in the "Edit issue fields" action.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.