Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira Behaviour field

Sharadkumar Bangera
Contributor
November 19, 2019

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 Champion
November 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 

Sharadkumar Bangera
Contributor
November 19, 2019

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 Champion
November 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