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

Jira Behaviour field

Hi ,

I have 2 script running in Jira Behavior field, When i follow Step 2 , it dont work it still capture point 1 script

1) I created field "Change Type" drop down list and the field in the list is "Emergency" Change
Exepcted result : This should hide all other approval except Duty Manager approver when select the Change type "Emergency ".
It is working fine with below script

def changetype = getFieldById("customfield_XXXXXX")
def BizOpsApprovers = getFieldById("customfield_XXXXXX")
def TechOpsApprovers = getFieldById("customfield_XXXXXX")
def DEVApprovers = getFieldById("customfield_XXXXXX")
def DutyManagerApprovers = getFieldById("customfield_XXXXXX")
log.debug("changetype Value" + changetype.getValue())

if (changetype.getValue() == "Emergency") {
BizOpsApprovers.setRequired(false);
TechOpsApprovers.setRequired(false);
DEVApprovers.setRequired(false);
DutyManagerApprovers.setRequired(true);
DutyManagerApprovers.setHidden(false);
DEVApprovers.setHidden(true);
BizOpsApprovers.setHidden(true);
TechOpsApprovers.setHidden(true);
}

2) I have another field "SAP Change" drop down list (Yes / No)
Expected result: When I select SAP Field "YES" and Change Type ""Emergency" , Duty Manager approver to be hidden and Product line approval to be Active
I tried below script but failed bcz when i select SAP change  YES and  Change Type "Emergency" it pickup point 1st script, current script is nor read by Field.

def SAPChange = getFieldById("customfield_XXXX")
Def ProductlineApproval = getFieldById("customfield_XXXX")
DutyManagerApprovers.setRequired(true);
log.debug("SAPChange Value" + SAPChange.getValue())
log.debug("changetype Value" + changetype.getValue())
if (SAPChange.getValue() == "Yes") && (changetype.getValue() == "Emergency") {
DutyManagerApprovers.setHidden(true);
ProductlineApproval.setHidden(false);}

1 answer

0 votes
Antoine Berry Community Leader Nov 19, 2019

Hi @Sharadkumar Bangera ,

Please make sure the second script is executing on the "SAP Change" custom field. Also mind the parentheses used for the if : 

if ((SAPChange.getValue() == "Yes") && (changetype.getValue() == "Emergency")) {

Let me know if that helped.

Antoine 

No, it did not help.It still pickup the first script.

 

When i select SAP Change "YES" from Detail tab and Change Type "Emergency" from analyses tab, In approval tab , the duty manager approver still appears bcz of the script created in point 1.

The expectation is when i select SAP Change YES and Change Type Emergency , it should show only product line approval 

Antoine Berry Community Leader Nov 19, 2019

If you add this line in the second script (first line)

log.error("script 2 is executing")

What do the logs display ?

Suggest an answer

Log in or Sign up to answer
TAGS

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