I need to update the assignee in tickets as they transition status, but only if another field is populated in the ticket. If that other field is blank, the assignee should stay as is (or if it's easier, I can set the assignee to the reporter, which is the value it will already be anyway).
The post functions in JIRA don't allow this, and the custom functions don't seem to cover it either. It's looking like this is something that a script needs to be written for. I'm fine with that, but couldn't find any examples to go off of when googling... maybe I'm searching with the wrong terminology since I'm not a JIRA expert?
If it helps, here's what I'm trying to do in psuedo code...
on transition from state1 to state2 if qa_resource field is not null assignee = qa_resource else do nothing, or assignee = reporter if easier
Thanks in advance for any help!
This is an extremely common use case for Script Runner... on your transition put the following custom script post-function FIRST:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.MutableIssue MutableIssue issue = issue def customFieldManager = ComponentAccessor.getCustomFieldManager() def qaResourceCf = customFieldManager.getCustomFieldObjectByName("QA Resource") def qaResource = issue.getCustomFieldValue(qaResourceCf) if (qaResource) { issue.setAssigneeId(qaResource.name) } else { issue.setAssignee(issue.reporter) }
(totally untested)
This is a pretty standard use case for the Update issues post function from JIRA Command Line Interface (CLI) which allows you to condition whether or not the update should occur. To set a field to 2 different values based on a couple of conditions, you may need multiple post functions where the conditioning determines which update is going to occur.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've been wanting to use your CLI tool, but unfortunately the budget I was given for add-ons is $0 (for now anyway). Hopefully we'll be able to buy it in the future.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You don't say if the new assignee is to be selected by the person making the transition or you want it to be decided inside JIRA somehow. Also, is the 'checked' field already set or being set. If already set you can use a condition on the workflow. If being set you'll need some kind of script. If it is already set you can do this by having 2 transitions. On with the condition of the checked field set and one with it not set. Only one will be visible. For the one with the field set just transition the issue without presenting the assignee field. On the other, present it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The new assignee is to be decided inside Jira - the new assignee should be set only if the QA Resource field is populated. If the QA Resource field is left blank, the assignee field should be left as is. The 'checked' field is already set, though it's not a required field so it's possible that the field is blank. That's why I need to check - if the field is blank, do nothing, if it's populated, update the asignee to be the user listed in the field. I don't think I can have 2 transitions, because the user should only see one transition to go forward at this point in the workflow, and the assignee should only be updated if the QA Resource field was populated, otherwise it should stay as is.
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.