I have a check box that if checked it needs to validate that a separate custom field needs to contain data or the ticket cannot be closed. however if the check box is not checked the the custom field can remain empty.
Hi IrshadI'm afraid it is not possible with out-of-the-box Jira validators.You should use something like Power Scripts For Jira to create a custom validator with if-else conditions.Here is an example of script that could be helpfulhttps://confluence.cprime.io/display/TR/Validators#Validators-Forceacustomfieldtoberequiredifanotherfieldwassettoacertainvalue
Hello @Irshad Sheik
It's not possible out of the box, I have implemented something similar using the Behvaiour module of the Script runner paid plugin.
Possible duplicate
https://community.atlassian.com/t5/Jira-Core-questions/Script-Runner-Behaviours-Hide-Show-based-on-checkbox-selection/qaq-p/306754
Morning
i tried the following and am getting an error:
string errorMsg = "Please enter Billing Instruction Number";if (customfield_13500 == 1 && !hasInput("customfield_13600")) {return false,"customfield_13600", errorMsg;}
the comma after false is producing an error saying expecting } but got ,
I think there is some error in how you specifying custom fields and its value.On my test instance it throws a different error and if i change fields to those i got on my instance and hit Check it says "Looks good"Try to use this
string errorMsg = "Please enter Billing Instruction Number";if ("customfield_13500" == 1 && !hasInput("customfield_13600")) {return false, "customfield_13600", errorMsg;}Also you should open any issue that contains those fields with JSON representation and check if field names and value you specifying are correct.
For JSON representation
https://<your jira URL>/rest/api/2/issue/<issuekey>?expand=names
would it matter that im using script runner and not power scripts??
Have you gone through the link which I have shared above as it contains a pretty similar code snippet which is required in your scenario.
i have gone thru the link, but im still struggling on this, ive gotten so far:
def checkBoxField = getFieldByID()def checkBoxFieldVal = checkBoxField.getValue()def BI = getFieldByName('Billing Instruction')
if (checkBoxFieldVal == 1){}
not sure if im on the right path or whats left.
It looks like you're new here. Sign in or register to get started.