Allow Current Reporter to edit Reporter field on a specific Status only in Jira data center?

Digvijay Singh Gehlot
Contributor
August 13, 2024

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

2 answers

2 accepted

1 vote
Answer accepted
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 14, 2024

Hi @Digvijay Singh Gehlot

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:-

behaviour_config.png

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

 

Digvijay Singh Gehlot
Contributor
August 16, 2024

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

0 votes
Answer accepted
Tomasz Kowalczyk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 13, 2024

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

Digvijay Singh Gehlot
Contributor
August 13, 2024

Hi @Tomasz Kowalczyk 

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?

Tomasz Kowalczyk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 13, 2024

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

Digvijay Singh Gehlot
Contributor
August 13, 2024

Hi @Tomasz Kowalczyk 

Thanks again. 

I am able to set the Property Key and Value as you guided.

I observed that:

  • After setting the property: jira.permission.modifyreporter.group.1 and the currentUser is NOT a part of Group 1 then the Reporter field is NOT visible on the Edit Issue screen.

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:

  • When currentUser as Reporter (NOT a part of Group 1), opens the Edit Screen on a specific status, he is able to see the Reporter field as ReadOnly, hence he is not able to edit it.
  • When user from Group 1, opens the Edit screen on a same status, he can edit the Reporter field. 

Looking forward to hearing from you soon.

Tomasz Kowalczyk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 13, 2024

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 

Suggest an answer

Log in or Sign up to answer