Forums

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

Cascading field type vallidation with issue type in scriptrunner

Hi, Guys.

 

I have a problem with script runner. could you help me?

 

I use cascading field and I know how to check validation via script runner, Like this 'cfValues["Complaint type"]?.keySet()?.size() == 2'

 

but I just wanna add one more condition with some of issue type.

 

for example, issuetype name is 'complaint' . I just fill out scriprunner as below, but I have failed. 

(1) issue.issueType.name == 'Complaint' || cfValues["Complaint type"]?.keySet()?.size() == 2

(2) if (issue.issueType.name == 'Complaint') {
 cfValues["Complaint type"]?.keySet()?.size() == 2}

 

where is my pain point?

 

Best regards,

Nate

1 answer

1 accepted

1 vote
Answer accepted
Tarun Sapra
Community Champion
December 10, 2018

Hello 

Could you please share the full validation condition that you want to implmement, what do you mean by "cfValues["Complaint type"]?.keySet()?.size() == 2'"

In your validation you want the issueType to be "Complaint" and what's the other condition which you want?

Sorry, My description was not enough.

I just wanna add 'validation for multi-cascading' in Customfield 'Complaint type' when issue type is 'Complaint'. I don't wanna apply other issue types.

이미지 1095.jpg

Tarun Sapra
Community Champion
December 11, 2018

Hello,

It should be easy to implement with SR plugin

But you still have not described as to what kind of validation you want to add for the custom field "Complaint type" , should it have single value or should it have both values or should it have certain specific values.

Test December 11, 2018

Sorry. I want to validate both value via SR plugin

Tarun Sapra
Community Champion
December 11, 2018
if(issue.issueType.name == 'Complaint') {
if (cfValues['Complaint type']?.values()*.value == ['AA', 'AB']) {
return true;

} else {
return false;
}
}

return true;
Tarun Sapra
Community Champion
December 11, 2018

In the above example, replace AA, AB values with the values of your custom field "Complaint type"

Suggest an answer

Log in or Sign up to answer