Is it possible with Behaviours, to make a comment required on the change of the assignee?

Hi,

it would be great, if you provided me with a solution for the following problem:

Our users should provide a comment everytime the assignee is changed. Using the workflow validators is not enough for solving the problem, because there would still be the possibility for the users to use the button "Assign". Then no validation would be running and no comment required.

Hence, it seems to be the best way to introduce a Behaviour, that checks the changing of the Assignee and makes a comment required, if the Assignee is changed indeed. If the Assignee stays the same - f.i. in a transition - a comment would NOT be required.

Do you think this would be possible? If yes, could you please provide me a solution or at least a hint (please note: I'm not a pro in scripting ;-) )

Thanks in advance,

Robert

2 answers

2 votes

The following should work:

if (getActionName() != "Create Issue") {
    def assigneeChanged = underlyingIssue.getAssigneeId() != getFieldById("assignee").value
    getFieldById("comment").setRequired(assigneeChanged)
}

That should be applied to the Assignee field. 

It's not going to work though if the user clicks the "Assign to me" link. I think that's a bug in that behaviours should hide that link, in the same way it will disable inline editing for fields that have a behaviour assigned.

Hi Jamie,

thanks a lot for the support. Your Script runs as described!

Regarding the "Assign to Me"-Option: We globally disabled inline editing. To be honest, I expected the "Assign-to-me"-Option to vanish with disabling inline editing. But to my surprise it didn't.

Do you know any other way to hide that option (but only in specific projects)?

Regards, Robert

I think you will need to inject some javascript, then depending on JIRA.Issue.getIssueKey() you would do: AJS.$("#assign-to-me").hide()

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,223 views 14 19
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot