Only allow current user to be assigned to custom user field

Janet M. April 18, 2017

I need to track the person who completed the peer review on each story. I'm creating a custom single user field and need it to only allow the current signed-in user to assign him/herself to this field for audit purposes. Populating the field as part of a workflow step is not preferred since teams use statuses/workflows differently. Any suggestions?

1 answer

0 votes
Rachel Wright
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 18, 2017

Hi Janet,

I think what you're saying is (1) you need to restrict who can edit a custom field and (2) you need to restrict the value they can enter into the custom field.  I don't think you can do either out of the box, but you might check out the "Behaviours plugin" which is now part of "ScriptRunner for JIRA".  See: https://marketplace.atlassian.com/plugins/com.onresolve.jira.groovy.groovyrunner/server/overview

I know you don't want to use a workflow transition, but I think that's a really good solution for your problem.  For true auditing value, you wouldn't want a user to manually add their name, you'd want the system to record it (and likely the timestamp) in the background.  Can you create a workflow just for this use case and project, instead of modifying the shared one other projects are using?

Implementation

If you decide to go the workflow transition route, I recommend one field to capture the name of the approver and a second field to capture the date or timestamp.  Make sure to show both fields on the "View" screen, but hide them on the "Create" and "Edit" screens.  The "Suite Utilities for JIRA" add-on provides the needed workflow transition.  See: https://marketplace.atlassian.com/plugins/com.googlecode.jira-suite-utilities/server/overview

For each approval transition, use an "Update Issue Custom Field" post function to dynamically set the approver value. The value is the name of the person who clicked the button. 

Example: The Peer Reviewer of the issue will be set to %%CURRENT_USER%%.

You can use a similar "Update Issue Custom Field" post function and the %%CURRENT_DATETIME%% notation to set the date field value.

I hope something in here helps you!

Rachel Wright

Suggest an answer

Log in or Sign up to answer