Hi,
How would I achive the below using Adaptavist's Behaviours Plugin
Scenario:
we have two single line text custom fields. I would like to know if there is anyway to enable/display these two fields to only to none other than one user in the instance.
I was also looking at Javascript options also from other answers, but our users use blockers to block scripts. So I was looking to enforce it from the server-side instead of the client-side.
Any assistance is greatly appreciated.
Hello @Rathna
Try code bellow, placed in behaviours mapped to your project, issuetypes and setted to fields you need.
import com.atlassian.jira.component.ComponentAccessor
def user = ComponentAccessor.getUserManager().getUserByName("username")
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
if (currentUser != user){
//left one depends on your case
getFieldById(getFieldChanged()).setHidden(true) // to be hidden
getFieldById(getFieldChanged()).setReadOnly(true) //to be readonly
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.