Hi Community,
I have created two screen tabs (Tab A, Tab B) and running a scriptrunner behaviour where I am showing the Tab A on Status A and Tab B on Status B only when opening Issue Edit screen.
My use-case is:
In Issue Edit Screen, I want to hide Tab B from the current user as Reporter if a value in the custom field (present on Tab A) is selected under Status A.
Please guide on how I can restrict the current user as Reporter to view the Tab B in Edit Screen based on a custom field value (present on Tab A) by using either scriptrunner, JMWE app, or JIRA Automation. It would be a great help.
Thank you.
For your requirement, it would be best to use the Server-Side Behaviour for the field you intend to use to determine if the tab should be hidden or not.
Below is a sample working code for your reference:-
import com.adaptavist.hapi.jira.users.Users
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours behaviours
def sampleList = getFieldById(fieldChanged)
def sampleListValue = sampleList.value.toString()
showTab(1)
if (sampleListValue == 'Option1' && underlyingIssue && Users.loggedInUser == underlyingIssue.reporter ) {
hideTab(1)
}
Please note that the sample working code above is not 100% exact to your environment. Hence, you will need to modify it accordingly.
Below is a screenshot of the Server-Side Behaviour configuration:-
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.