Hi Community,
I want to allow the currentUser as Reporter to edit the Reporter field on a specific Status (like "Open") only if he is NOT a part of particular Groups (like Group A, Group B, Group C).
If the currentUser as Reporter is part of above Groups, then he is allowed to edit Reporter field on any status of the workflow.
How can I configure this by using Scriptrunner, JMWE app, JSU, Jira automation or Validation/ Conditions/ Post-functions?
Please guide further and let me know if you need any additional details.
Thanks
For your requirement, it would be best to use ScriptRunner's Behaviour Initialiser.
Below is a sample working code for your reference:-
import com.adaptavist.hapi.jira.groups.Groups
import com.adaptavist.hapi.jira.users.Users
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours behaviours
def loggedInUser = Users.loggedInUser
def devGroup = Groups.getByName('Developers')
def reporter = getFieldById('reporter')
if (underlyingIssue) {
if (underlyingIssue.status.name == 'In Progress' && devGroup.contains(loggedInUser)) {
reporter.readOnly = false
} else {
reporter.readOnly = true
}
}
Please note that the sample working code above is not 100% exact to your environment. Hence, you must make the required modifications.
Below is a screenshot of the Behaviour configuration:-
Note: For the Behaviour to work, if the user whom you have added to the Group is not a Jira Admin, you must at least grant the user Project Admin permission else the user will not be able to edit the Reporter field once the Issue has been created and the Behaviour cannot be triggered.
I hope this helps to solve your question. :-)
Thank you and Kind regards,
Ram
Hi @Ram Kumar Aravindakshan _Adaptavist_
As always, thank you so much for providing a detailed explanation on how to use scriptrunner at its best to solve my specific requirements.
I clearly understood the workflow and will implement the same at my end, and let you know if I need any additional refinements.
Best,
Digvijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For open status you can use workflow properties like jira.permission.modifyreporter.user but i'm aware of that it require you to do that property for a group not a negation of a list of groups. So you can set that members of three groups can modify reporter. More you can read about here https://support.atlassian.com/jira-cloud-administration/docs/use-workflow-properties/
or here:
https://confluence.atlassian.com/adminjiraserver/workflow-properties-938847526.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your message.
I gone through the shared links but not able to find on how to pass this Property Key: jira.permission.modifyreporter.group for multiple groups on a particular status.
And I am also not able to find the Group value to enter in Property Value field in Jira-datacenter
Can you guide me further what will be the correct property key for multiple groups and how to find the Group id/value to set them in Property Value on a specific status in Jira data-center?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
well,
try like that:
first property
property:jira.permission.modifyreporter.group.1 value: <group name>
second property
property:jira.permission.modifyreporter.group.2 value:<second group name>
property value should be the name of a group
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks again.
I am able to set the Property Key and Value as you guided.
I observed that:
I would like to ask, is there a possibility to set the Reporter field as ReadOnly for the currentUser as Reporter (who is NOT part of Group 1) on a particular status when he opens the Edit Issue screen?
For example:
Looking forward to hearing from you soon.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, with properties you're able to set who CAN modify reporter not otherwise as i mentioned in my first answer. But you can achieve this by moderating groups. Why don't you try to achieve this by moderating also group membership. You can create gruop that gather all users/groups that CAN modify reporter and than just add that group to workflow properties
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.