Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to optimize the behaviours inline updated SR script against my custom field as it's slowing down

Edited

Hi,

We have updated the attached behaviours inline SR script against one of our custom field. Due to which form loading as become slow - please suggest on how to optimize this script to add into behaviours inline.

Also it's good how we can maintain this script better way as it's very tedious to update these options using behaviours inline SR script as these options are getting added, changed frequently (we have similar script added against other 10 to 12 Jira custom fields too), please share me the example GUI, which can be used to maintain our SR script to edit easily, helps us a lot.

 

import org.ofbiz.core.entity.GenericValue
import com.atlassian.jira.issue.customfields.manager.OptionsManager

FormField formComponent = getFieldById(fieldChanged)
FormField formSubcomponent1 = getFieldByName ("Serv Release tag")

def actionName = getActionName()
def actionId = getAction().getId()  
def componentFormValue = formComponent.getFormValue()

List componentIds = []
Map field1Options = [:]


if((actionId == null && actionName == null)||(actionId == 1 && actionName == "Create" )|| (actionId == 1441 && actionName == "Clone PR") ||(actionId == 1291 && actionName == "Internal Reopen") || (actionId == 721 && actionName == "Clone for All")|| (actionId == 771 && actionName == "Clone for All")|| (actionId == 811 && actionName == "Clone for All")|| (actionId == 871 && actionName == "Clone for All")|| (actionId == 911 && actionName == "Clone for All")|| (actionId == 971 && actionName == "Clone for All")|| (actionId == 1031 && actionName == "Clone for All")|| (actionId == 1251 && actionName == "Clone for All")|| (actionId == 1221 && actionName == "Clone for All")|| (actionId == 1201 && actionName == "Clone for All")|| (actionId == 1161 && actionName == "Clone for All")|| (actionId == 1121 && actionName == "Clone for All")|| (actionId == 1071 && actionName == "Clone for All"))
{
    formComponent.setReadOnly(false)
 }
else
{
    formComponent.setReadOnly(true)
}

 switch (componentFormValue) {
  case "10201" :
   field1Options.putAll (["10202":"Generic"])
   break
  case "10018" :
   field1Options.putAll (["10022":"Android_Our_Serv_07_010_28", "10023":"Android_Our_Serv_07_010_28A"])
   break
  case "10019" :
   field1Options.putAll (["10024":"Android_Our_Serv_07_010_28B", "10025":"Android_Our_Serv_07_010_28C"])
   break
  case "10020" :
   field1Options.putAll (["10026":"Android_Our_Serv_07_010_28D", "10027":"Android_Our_Serv_07_010_28E"])
   break
   
   case "10021" :
   field1Options.putAll (["10028":"Android_Our_Serv_07_010_28F", "10029":"Android_Our_Serv_07_010_28G"])
   break
case "10527" : //Our Serv 8.1
   field1Options.putAll (["10500":"My_Our_Serv_08_001_01_01_01",
"10501":"My_Our_Serv_08_001_01_01_01A",
"10502":"My_Our_Serv_08_001_01_01_01B",
"10503":"My_Our_Serv_08_001_01_01_01C",
"10504":"My_Our_Serv_08_001_01_01_01D",
"10505":"My_Our_Serv_08_001_01_01_01E",
"10506":"My_Our_Serv_08_001_01_01_01F",
"10507":"My_Our_Serv_08_001_01_01_01G",
"10508":"My_Our_Serv_08_001_01_01_01H",
"10509":"My_Our_Serv_08_001_01_01_01I",
"10510":"My_Our_Serv_08_001_01_01_01J",
"10511":"My_Our_Serv_08_001_01_01_01K",
"10512":"My_Our_Serv_08_001_01_01_01L",
"10513":"My_Our_Serv_08_001_01_01_01M",
"10514":"My_Our_Serv_08_001_01_01_01N",
"10515":"My_Our_Serv_08_001_01_01_01O",
"10516":"My_Our_Serv_08_001_01_01_01P",
"10517":"My_Our_Serv_08_001_01_01_01Q",
"10518":"My_Our_Serv_08_001_01_01_01R",
"10519":"My_Our_Serv_08_001_01_01_01S",
"10520":"My_Our_Serv_08_001_01_01_01T",
"10521":"My_Our_Serv_08_001_01_01_01U",
"10522":"My_Our_Serv_08_001_01_01_01V",
"10523":"My_Our_Serv_08_001_01_01_01W",
"10524":"My_Our_Serv_08_001_01_01_01X",
"10525":"My_Our_Serv_08_001_01_01_01Y",
"10526":"My_Our_Serv_08_001_01_01_01Z",
"11126":"My_Our_Serv_08_001_01_01_16F",                         
"11127":"My_Our_Serv_08_001_01_01_16G",
"11128":"My_Our_Serv_08_001_01_01_16H",
"11129":"My_Our_Serv_08_001_01_01_16I",
"11130":"My_Our_Serv_08_001_01_01_16J",                        
"11131":"My_Our_Serv_08_001_01_01_16K",
"11132":"My_Our_Serv_08_001_01_01_16L",
"11133":"My_Our_Serv_08_001_01_01_16M",
"11134":"My_Our_Serv_08_001_01_01_16N",
"11135":"My_Our_Serv_08_001_01_01_16O",
"11136":"My_Our_Serv_08_001_01_01_16P",
"11137":"My_Our_Serv_08_001_01_01_16Q",
"11138":"My_Our_Serv_08_001_01_01_16R",
"11139":"My_Our_Serv_08_001_01_01_16S",
"11140":"My_Our_Serv_08_001_01_01_16T",
"11141":"My_Our_Serv_08_001_01_01_16U",
"11142":"My_Our_Serv_08_001_01_01_16V",
"11143":"My_Our_Serv_08_001_01_01_16W",
"11144":"My_Our_Serv_08_001_01_01_16X",
"11145":"My_Our_Serv_08_001_01_01_16Y",
"11146":"My_Our_Serv_08_001_01_01_16Z",
"11459":"My_Our_Serv_08_001_01_01_17A",
"11460":"My_Our_Serv_08_001_01_01_17B",
"11461":"My_Our_Serv_08_001_01_01_17C",
"11462":"My_Our_Serv_08_001_01_01_17D",
"11463":"My_Our_Serv_08_001_01_01_17E",
"11464":"My_Our_Serv_08_001_01_01_17F",                         
"11465":"My_Our_Serv_08_001_01_01_17G",
"11466":"My_Our_Serv_08_001_01_01_17H",
"11467":"My_Our_Serv_08_001_01_01_17I",
"11468":"My_Our_Serv_08_001_01_01_17J",
"11469":"My_Our_Serv_08_001_01_01_17K",
"11470":"My_Our_Serv_08_001_01_01_17L",
"11471":"My_Our_Serv_08_001_01_01_17M",
"11472":"My_Our_Serv_08_001_01_01_17N",
"11473":"My_Our_Serv_08_001_01_01_17O",
"11474":"My_Our_Serv_08_001_01_01_17P",
"11475":"My_Our_Serv_08_001_01_01_17Q",                         
"11476":"My_Our_Serv_08_001_01_01_17R",
"11477":"My_Our_Serv_08_001_01_01_17S",
"11478":"My_Our_Serv_08_001_01_01_17T",
"11479":"My_Our_Serv_08_001_01_01_17U",
"11480":"My_Our_Serv_08_001_01_01_17V",
"11481":"My_Our_Serv_08_001_01_01_17W",
"11482":"My_Our_Serv_08_001_01_01_17X",
"11483":"My_Our_Serv_08_001_01_01_17Y",
"11484":"My_Our_Serv_08_001_01_01_17Z",
"12042":"My_Our_Serv_08_001_01_01_18A",
"12043":"My_Our_Serv_08_001_01_01_18B",
"12044":"My_Our_Serv_08_001_01_01_18C",
"12045":"My_Our_Serv_08_001_01_01_18D",
"12046":"My_Our_Serv_08_001_01_01_18E",
"12047":"My_Our_Serv_08_001_01_01_18F",
"12048":"My_Our_Serv_08_001_01_01_18G",
"12049":"My_Our_Serv_08_001_01_01_18H",
"12050":"My_Our_Serv_08_001_01_01_18I",
"12051":"My_Our_Serv_08_001_01_01_18J",
"12052":"My_Our_Serv_08_001_01_01_18K",
"12053":"My_Our_Serv_08_001_01_01_18L",
"12054":"My_Our_Serv_08_001_01_01_18M",
"12055":"My_Our_Serv_08_001_01_01_18N",
"12056":"My_Our_Serv_08_001_01_01_18O",
"12057":"My_Our_Serv_08_001_01_01_18P",
"12058":"My_Our_Serv_08_001_01_01_18Q",
"12059":"My_Our_Serv_08_001_01_01_18R",
"12060":"My_Our_Serv_08_001_01_01_18S",
"12061":"My_Our_Serv_08_001_01_01_18T",
"12062":"My_Our_Serv_08_001_01_01_18U",
"12063":"My_Our_Serv_08_001_01_01_18V",
"12064":"My_Our_Serv_08_001_01_01_18W",
"12065":"My_Our_Serv_08_001_01_01_18X",
"12066":"My_Our_Serv_08_001_01_01_18Y",
"12067":"My_Our_Serv_08_001_01_01_18Z",
"13285":"My_Our_Serv__08_001_01_01_20A",
"13286":"My_Our_Serv__08_001_01_01_20B",
"13287":"My_Our_Serv__08_001_01_01_20C",
"13288":"My_Our_Serv__08_001_01_01_20D",
"13289":"My_Our_Serv__08_001_01_01_20E",
"13290":"My_Our_Serv__08_001_01_01_20F",
"13291":"My_Our_Serv__08_001_01_01_20G",
"13292":"My_Our_Serv__08_001_01_01_20H",
"13293":"My_Our_Serv__08_001_01_01_20I",
"13294":"My_Our_Serv__08_001_01_01_20J",
"13295":"My_Our_Serv__08_001_01_01_20K",
"13296":"My_Our_Serv__08_001_01_01_20L",
"13297":"My_Our_Serv__08_001_01_01_20M",
"13298":"My_Our_Serv__08_001_01_01_20N",
"13299":"My_Our_Serv__08_001_01_01_20O",
"13300":"My_Our_Serv__08_001_01_01_20P",
"13301":"My_Our_Serv__08_001_01_01_20Q",
"13302":"My_Our_Serv__08_001_01_01_20R",
"13303":"My_Our_Serv__08_001_01_01_20S",
"13304":"My_Our_Serv__08_001_01_01_20T",
"13305":"My_Our_Serv__08_001_01_01_20U",
"13306":"My_Our_Serv__08_001_01_01_20V",
"13307":"My_Our_Serv__08_001_01_01_20W",
"13308":"My_Our_Serv__08_001_01_01_20X",
"13309":"My_Our_Serv__08_001_01_01_20Y",
"13310":"My_Our_Serv__08_001_01_01_20Z",
"14483":"My_Our_Serv_08_001_01_01_21A",
"14484":"My_Our_Serv_08_001_01_01_21B",
"14485":"My_Our_Serv_08_001_01_01_21C",
"14486":"My_Our_Serv_08_001_01_01_21D",
"14487":"My_Our_Serv_08_001_01_01_21E",
"14488":"My_Our_Serv_08_001_01_01_21F",
"14489":"My_Our_Serv_08_001_01_01_21G",
"14490":"My_Our_Serv_08_001_01_01_21H",
"14491":"My_Our_Serv_08_001_01_01_21I",
"14492":"My_Our_Serv_08_001_01_01_21J",
"14493":"My_Our_Serv_08_001_01_01_21K",
"14494":"My_Our_Serv_08_001_01_01_21L",
"14495":"My_Our_Serv_08_001_01_01_21M",
"14496":"My_Our_Serv_08_001_01_01_21N",
"14497":"My_Our_Serv_08_001_01_01_21O",
"14498":"My_Our_Serv_08_001_01_01_21P",
"14499":"My_Our_Serv_08_001_01_01_21Q",
"14500":"My_Our_Serv_08_001_01_01_21R",
"14501":"My_Our_Serv_08_001_01_01_21S",
"14502":"My_Our_Serv_08_001_01_01_21T",
"14503":"My_Our_Serv_08_001_01_01_21U",
"14504":"My_Our_Serv_08_001_01_01_21V",
"14505":"My_Our_Serv_08_001_01_01_21W",
"14506":"My_Our_Serv_08_001_01_01_21X",
"14507":"My_Our_Serv_08_001_01_01_21Y",
"14508":"My_Our_Serv_08_001_01_01_21Z",
"15331":"My_Our_Serv_08_001_01_01_22I",
"15332":"My_Our_Serv_08_001_01_01_22J",
"15333":"My_Our_Serv_08_001_01_01_22K",
"15334":"My_Our_Serv_08_001_01_01_22L",
"15335":"My_Our_Serv_08_001_01_01_22M",
"15336":"My_Our_Serv_08_001_01_01_22N",
"15337":"My_Our_Serv_08_001_01_01_22O",
"15338":"My_Our_Serv_08_001_01_01_22P",
"15339":"My_Our_Serv_08_001_01_01_22Q",
"15340":"My_Our_Serv_08_001_01_01_22R",
"15341":"My_Our_Serv_08_001_01_01_22S",
"15342":"My_Our_Serv_08_001_01_01_22T",
"15343":"My_Our_Serv_08_001_01_01_22U",
"15344":"My_Our_Serv_08_001_01_01_22V",
"15345":"My_Our_Serv_08_001_01_01_22W",
"15346":"My_Our_Serv_08_001_01_01_22X",
"15347":"My_Our_Serv_08_001_01_01_22Y",
"15348":"My_Our_Serv_08_001_01_01_22Z",
"16102":"My_Our_Serv_08_001_01_01_24",
"16103":"My_Our_Serv_08_001_01_01_24A",
"16104":"My_Our_Serv_08_001_01_01_24B",
"16105":"My_Our_Serv_08_001_01_01_24C",
"16106":"My_Our_Serv_08_001_01_01_24D",
"16107":"My_Our_Serv_08_001_01_01_24E",
"16108":"My_Our_Serv_08_001_01_01_24F",
"16109":"My_Our_Serv_08_001_01_01_24G",
"16110":"My_Our_Serv_08_001_01_01_24H",
"16111":"My_Our_Serv_08_001_01_01_24I",
"16112":"My_Our_Serv_08_001_01_01_24J",
"16176":"My_Our_Serv_08_001_01_01_24K",
"16177":"My_Our_Serv_08_001_01_01_24L",
"16178":"My_Our_Serv_08_001_01_01_24M",
"16179":"My_Our_Serv_08_001_01_01_24N",
"16180":"My_Our_Serv_08_001_01_01_24O",
"16181":"My_Our_Serv_08_001_01_01_24P",
"16182":"My_Our_Serv_08_001_01_01_24Q",
"16183":"My_Our_Serv_08_001_01_01_24R",
"16184":"My_Our_Serv_08_001_01_01_24S",
"16185":"My_Our_Serv_08_001_01_01_24T",
"16186":"My_Our_Serv_08_001_01_01_24U",
"16187":"My_Our_Serv_08_001_01_01_24V",
"16188":"My_Our_Serv_08_001_01_01_24W",
"16189":"My_Our_Serv_08_001_01_01_24X",
"16190":"My_Our_Serv_08_001_01_01_24Y",
"16191":"My_Our_Serv_08_001_01_01_24Z",
"16837":"My_Our_Serv_08_001_01_01_25A",
"16838":"My_Our_Serv_08_001_01_01_25B",
"16839":"My_Our_Serv_08_001_01_01_25C",
"16840":"My_Our_Serv_08_001_01_01_25D",
"16841":"My_Our_Serv_08_001_01_01_25E",
"16842":"My_Our_Serv_08_001_01_01_25F",
"16843":"My_Our_Serv_08_001_01_01_25G",
"16844":"My_Our_Serv_08_001_01_01_25H",
"16845":"My_Our_Serv_08_001_01_01_25I",
"16846":"My_Our_Serv_08_001_01_01_25J",
"16847":"My_Our_Serv_08_001_01_01_25K",
"16848":"My_Our_Serv_08_001_01_01_25L",
"16849":"My_Our_Serv_08_001_01_01_25M",
"16850":"My_Our_Serv_08_001_01_01_25N",
"16851":"My_Our_Serv_08_001_01_01_25O",
"16852":"My_Our_Serv_08_001_01_01_25P",
"16853":"My_Our_Serv_08_001_01_01_25Q",
"16854":"My_Our_Serv_08_001_01_01_25R",
"16855":"My_Our_Serv_08_001_01_01_25S",
"16856":"My_Our_Serv_08_001_01_01_25T",
"16857":"My_Our_Serv_08_001_01_01_25U",
"16858":"My_Our_Serv_08_001_01_01_25V",
"16859":"My_Our_Serv_08_001_01_01_25W",
"16860":"My_Our_Serv_08_001_01_01_25X",
"16861":"My_Our_Serv_08_001_01_01_25Y",
"16862":"My_Our_Serv_08_001_01_01_25Z"])                          
break
case "10528": //Our UI 8.1
   field1Options.putAll ([
"15524":"My_Our_Serv_UI_08_01_00_07Z"])                          
break
case "10543": //Our iOS 8.1
   field1Options.putAll ([
"14049":"My_iOS_Our_Serv_08_001_01_07E",
"14050":"My_iOS_Our_Serv_08_001_01_07F",
"14051":"My_iOS_Our_Serv_08_001_01_07G",
"14052":"My_iOS_Our_Serv_08_001_01_07H",
"14053":"My_iOS_Our_Serv_08_001_01_07I",
"14054":"My_iOS_Our_Serv_08_001_01_07J",
"14055":"My_iOS_Our_Serv_08_001_01_07K",
"14056":"My_iOS_Our_Serv_08_001_01_07L",
"14057":"My_iOS_Our_Serv_08_001_01_07M",
"14058":"My_iOS_Our_Serv_08_001_01_07N",
"14059":"My_iOS_Our_Serv_08_001_01_07O",
"14060":"My_iOS_Our_Serv_08_001_01_07P",
"14061":"My_iOS_Our_Serv_08_001_01_07Q",
"14062":"My_iOS_Our_Serv_08_001_01_07R",
"14063":"My_iOS_Our_Serv_08_001_01_07S",
"14064":"My_iOS_Our_Serv_08_001_01_07T",
"14065":"My_iOS_Our_Serv_08_001_01_07U",
"14066":"My_iOS_Our_Serv_08_001_01_07V",
"14067":"My_iOS_Our_Serv_08_001_01_07W",
"14068":"My_iOS_Our_Serv_08_001_01_07X",
"14069":"My_iOS_Our_Serv_08_001_01_07Y",
"14070":"My_iOS_Our_Serv_08_001_01_07Z"])
break
case "10782": //WEBPLUGIN_3.0
   field1Options.putAll ([
"10783":"WEBPLUGIN_P_3_0_0_0",
"10784":"WEBPLUGIN_P_3_0_0_1",
"10785":"WEBPLUGIN_P_3_0_0_2",
"10786":"WEBPLUGIN_P_3_0_0_3"])
break
case "10801": //DISP_3.0
   field1Options.putAll ([
"10802":"DISP_03_0_0_0",
"10803":"DISP_03_0_0_1",
"10804":"DISP_03_0_0_2",
"10805":"DISP_03_0_0_3",
"10806":"DISP_03_0_0_4",
"10807":"DISP_03_0_0_5",
"11585":"DISP_03_0_0_6",
"11586":"DISP_03_0_0_7",
"11587":"DISP_03_0_0_8",
"11588":"DISP_03_0_0_9"])
break
case "22731" : // Our Dispat90
   field1Options.putAll ([
"22732":"OurDIST_P_2_0_0_0",
"22733":"OurDIST_P_2_0_0_1",
"22734":"OurDIST_P_2_0_0_2",
"22735":"OurDIST_P_2_0_0_3",
"22736":"OurDIST_P_2_0_0_4",
"22737":"OurDIST_P_2_0_0_5"])
break
        
    case "-1" :
   field1Options.put ("-1", "None")
   break
 }
formSubcomponent1.setFieldOptions (field1Options)

 

- Manju 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Do you use Jira Cloud with Microsoft Teams?

Hi, Jira users! Do you use Jira alongside Microsoft Teams? We want to hear how you’ve used the power of Jira Cloud and Microsoft Teams (via the Jira Cloud for Microsoft Teams app) to achieve a team...

243 views 1 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you