Forums

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

Create Initiative based on Fields conditions

Joel Batac
Contributor
July 8, 2022

Hi,

 So i got 2 fields Name and Reporting Level. I only want user to be able create Initiative if any of following conditions are met:

1. If Reporting Level is 6 and Name is Empty. 

2. If report Level is between 1-5 and Name is NOT empty.

 

If Reporting Level is between 1-5 and Name IS empty, user gets an error message. 

 

Any advice on achieving this?

 

 

2 answers

0 votes
Andrea Pannitti
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 12, 2022

Hi @Joel Batac,

you could do it with a Simple scripted validator with the following code:

def name = cfValues['Name']?.value
def reportingLevel = cfValues['Reporting Level']?.value

int intReportingLevel = (reportingLevel != null && !reportingLevel.toString().trim().isEmpty()) ? reportingLevel as Integer : 0
String strName = (name != null && !name.toString().trim().isEmpty()) ? name.toString() : ""

return (intReportingLevel == 6 && strName.isEmpty()) || (intReportingLevel < 6 && !strName.isEmpty())
0 votes
Florian Bonniec
Community Champion
July 9, 2022

Hi,

 

You will need an app for that, not sure what you already have but you should be able to achieve that with Scriptrunner. 

Workflow Toolbox should work also and probably Jira Suite Utilities.

 

With scriptrunner you should be able to use a simple script validator.

Suggest an answer

Log in or Sign up to answer