We have around 700 projects in JIRA. In that, around 500 projects uses same Issue Type, Screen and Workflow schemes. We want to display a custom field only to 300 specific projects among 500.
Is there any effective way to do that?
Currently, We have added the field to the screen which is globally used. And, we are controlling it through script runner behaviour. By default, the custom field will be hidden for all projects. In the Custom beehaviour script, we have hard-coded the project keys to which the field should be visible. And, we are checking the project key in *IF* condition. If the condition is true, then we are overriding the default behaviour.
Here is our script,
import com.atlassian.jira.project.Project
Project project = getIssueContext().getProjectObject()
String projectKey = project.getKey()
def feature_link_field = getFieldById('customfield_12345') // Defining an object for Feature Link issue
def projectKeys = ["AAAA","BBBB","CCCC","DDDD","TEST","FTHGYU","COLCRO","COLCS","COLCT","COLCW","COLCWA","COLDBRR","COLE","COLECPO","COLEE","COLEO","COLEP","COLET","COLFPI","COLFTE","COLHC","COLHVC","COLL","COLLS","COLP","COLPA","COLPAS","COLPAT","COLPDE","COLPE","COLPERA","COLPI","COLPLM","COLPOST","COLPP","COLPRAN","COLPS","COLRDD","COLRH","COLRIE","COLRNR","COLRPP","COLRR","COLRS","COLRULES","COLSEPLM","COLSM","COLTE","COLTIR","COLTRAIN","COLTX","COLUX","COLVZ","COLWA","COLWE","COLWMF","COMAA","CONAPI","CONINT","CONMGMT","COORDAUTO","COR","COSA","COSCH","CPDBEC","CPDC","CPDFEC","CPOR","CPS","CRP","CRZS","CSAM","CSBRAND","CSDBI","CSS","CSU","CSY","CT","CUSTSOL","CVB","DATAGOV","DATASEC","DCSS","DFOPS","DIRECT","DOCHUB","DPETL","DSCC","DSCOL","DSEE","DSF","DSINT","DSML","DSNDS","DSPL","DSRX","DSTTO","DTT","ECARE","ECFA","EDBI","EDF","EDIBI","EENG","EFHIR","EHPE","EICDTO","EICP","EIIT","EINT","EINTP","EIP","EMRIND","EPRSBE","ERCD","ERCDC","ERX","ESDS","ESI","ESORS","ETLAUTO","ETLAUTOBLR","ETLPD","GLOBPL","HCC","HCLCOG","HCLED","HCLEI","HCLIS","HCLN","HCLOW","HCLS","HCLSP","HCLT","HCLUX","HCOBP","HCOCIH","HCOGF","HCOI","HCOPCA","HCORDP","HCORS","HCOTC","HCPF","HOSPL","IAM","IDP","IMM","INTRPSVC","IOCLIN","IOCOL","ISAB","ISARCH","ISBCS","ISBI","ISCAPS","ISCONN","ISKM","ISMS","ISTESTAUTO","KMEG","MA","MCS","MDP","MDPBI","MDPM2","MEDS","MEHRI","MESACT","MMI","MMV","MNLP","MOM","MP","MSD","MVA","NGDA","NPO","NVSE","ORP","ORS","P2AB","P2AG","P2AM","P2AP","P2DI","P2DP","P2DXE","P2DXP","P2EDIP","P2FG","P2HOBJ","P2LS","P2MN","P2MS","P2NBCD","P2NDT","PAN","PAQE","PBI","PCCS","PCDI","PCLBI","PCM","PCPI","PCSO","PDAC","PDD","PDDC","PDFRB","PDFSA","PDM","PDO","PDOP","PEI","PHOPS","PHPM","PHRM","PIO","PIOCON","PLAMDP","PLATAC","PLATBI","PLATFC","PLATNDA","PLATRT","PLATSECR","PLAW","PLBKUP","PLFC","PNQS","POM","POPDP","POPGL","POPIM","POPOPS","POPPCA","POPSB","PPD","PPDS","PPO","PPSPA","PRAXDS","PRINT","PSCI","PSMG","PSPCC","PSPDA","PSPDEVO","PSPIOM","PSPIOPE","PSPIOW","PSPWF","PSQIR","PSUSA","PSW","PSWA","PTD","PTF","PWA","PXMAC","PXMMP","PZO","QMAASBI","QMAASREQ","QMAT","QMDA","QMDH","QMII","QMQRS","QPAPM","QRULES","RDP","REPAPI","RESCOUN","RESEARCH","RIDE","ROPS","RPA","RPRACM","RULESMOD","SDO","SEC","SECH","SECLINDOC","SECLORDERS","SECLTASKS","SECRT","SEPAE","SGD","SL","SMAB","SSDA","SUA","SWITCH","TEES","TGH","UIAMIACA","UIAMUA","UPEPWA","UTMC","UXDS","XDEM","XDGE","XRAYCOL"];
if (projectKeys.contains(projectKey))
{
feature_link_field.setHidden(false);
}
// End of the script;
We really don't want to control it this way as the list is just getting evolved. So, Please let me know if there is any effective way to do it.
I have also tried with Profiled. But it did not help. I thought, I can write a behaviour script to get Profiled value and based on the value, i can set the property. But I could able to read the Profiled value in behaviour script. It always returns null. I have raised question on community for that too.
Here It is - https://community.atlassian.com/t5/Jira-questions/How-to-check-Profiled-value-in-script-runner-behaviour/qaq-p/1148405#M365808