Looking to clear Assignee field on a transition back to initial status, IF task has reached a 'final' state

In some workflows within our JIRA Core (cloud) instance, I have a transition that is available to ALL steps which will send the task back to its initial status of "Pending".  

I would like to clear the Assignee field when that transition is selected IF the task is in a FINAL status (e.g., status = Done).  

Can this be accomplished using built-in JIRA transition operations (Condition, Validator, Post)?  If so, can someone give a suggestion on accomplishing it.

 

To summarize:

-Our initial status is called "Pending", all statuses can transition back to it.  That transition is named “Initiate Amendment

-Interested in clearing the built-in “Assignee” field, WHEN the "Initiate Amendment" transition is selected IF the sub-task has reached a "Done" status

 

Thanks in advance!

1 answer

Hi Stephen,

You can use ScriptRunner for JIRA Cloud to achieve this. You can create a workflow post function on the transition you mentioned with a condition to check which status you're transitioning from, and then remove the assignee in the main code for the transition:

// The condition
(transitionInput.transition as Map).from_status == 'Done'

and...

// Update the issue, removing the assignee
def resp = put("/rest/api/2/issue/${issue.key}") 
    .header("Content-Type", "application/json")
    .body([
        fields:[
                'assignee': null
        ]
    ])
    .asString()
assert resp.status == 204

Here's a screenshot too https://drive.google.com/file/d/0B6nyDigBko1ldTR3c1FrQk50X0E/view?usp=sharing

Let me know if you need more help (or if I've left some bugs in the code above!),

Jon

Thanks, Jon.  I'm going to try it out shortly!

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Asked 6 hours ago in Confluence

What are the resources that you use to learn more about Atlassian Products?

I am gathering information about resources available for Atlassian product knowledge transferring for a presentation in our local Atlassian User Group. I want to group them in four categories From ...

46 views 3 3
View question

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you