During a transition in the middle of my workflow, I use a screen to capture additional field values. However, two fields are only required when another custom field value equals "Non-PO Invoice". I'm trying to use ScriptRunner to validate these two fields.
I attempted the script as follows:
if (cfValues['Invoice type']?.value == 'Non-PO Invoice')
{
cfValues['Account Code'] != null && cfValues['Cost Center'] != null
}
This script is doing one thing correctly: it requires me to have a value in the 'Account Code' and 'Cost Center' custom fields before I transition. But this requirement is not contingent on or controlled by the value of the 'Invoice type' custom field.
I only want those two fields to be required when "Non-PO Invoice" is selected in the 'Invoice type' custom field.
What am I doing wrong?