I have the below sample code. I want to enable a field to few projects (3) out of "ALL PROJECTS"(100) selection from the mapping list. How do I mention the field to be available only for a few projects in the script?
import com.atlassian.jira.issue.IssueFieldConstants
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
final String fieldName = 'TextField'
// get field by name and hide it
getFieldByName(fieldName).setHidden(true)
Hi @Aisha M
You can do this using Custom Field > Search Field > Configure , select only those project in which you want this field to appear, or via field behavior you need to map only 3 project in which you want this field to appear. No need to write script
@Vikrant Yadav Thank you for the reply. Yes I m aware of that. I m looking at using Behaviours specifically.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In behavior also , you can hide the field using behaviour :-
if (issuetype.contains("Story")) {
fieldToHide.setHidden(false)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Vikrant Yadav Thanks you. How do I ensure the behaviour doesnt hide the field to a few number of projects alone ? Like, I have 100 projects & want the field to be visible in only a few alone. How to call that from the script.
Under Mapping, I want to specify "ALL PROJECTS" , then in the server-side script, I want to exclude the hiding of fields for a few projects alone from the list of "ALL PROJECTS".
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.
@Vikrant Yadav Yes. But the problem is I have close to 200 for the field to be hidden & field available for maybe 6. So, we don't want to manually select 200 projects to hide the field. Hence looking for ways to select all projects at the mapping step & then mention the 6 projects alone for which the field should be available from the script.
So basically,
In Mapping - "ALL PROJECTS"
In script - Keep the field hidden for ALL PROJECTS except for the 6
Hope I made sense
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Aisha M Did you find a solution to this? - I'm also searching for a way to invert/except specific projects/issues types from a behaviour.
Ex. Hide Time Tracking for ALL PROJECTS except 3 projects.
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.