How to use custom fields in connect's jiraWorkflowValidators module

I’m trying to do a connect workflow validator following this documentation. Custom fields are available according to this other documentation.

This is the jiraWorkflowValidators entry in my descriptor

"jiraWorkflowValidators": [{
   "key": "workflow-validator-edf",
   "name": {
      "value": "Early Detection Phase mandatory validation"
   },
   "description": {
      "value": "Early Detection Phase fields should be mandatory when resolution is fixed"
   },
   "errorMessage": {
      "expression": "'Early Detection Phase can not be empty when Resolution is fixed'"
  },
  "expression": "!issue.customfield_10077" 
}]

My installation is however throwing error (“An error occurred during installation. Contact the app vendor for support.”)

If I change expression to “expression”: “issue.resolution.name == ‘Done’” as below the app installs (and runs) correctly

"jiraWorkflowValidators": [{
   "key": "workflow-validator-edf",
   "name": {
      "value": "Early Detection Phase mandatory validation"
   },
   "description": {
      "value": "Early Detection Phase fields should be mandatory when resolution is fixed"
   },
   "errorMessage": {
      "expression": "'Early Detection Phase can not be empty when Resolution is fixed'"
   },
   "expression": "issue.resolution.name == 'Done'" 
}]

Any suggestions?

I don’t think this expression returns a boolean. What kind of custom field is that? And what were you trying to accomplish with the “not” operator?

In the expression that does work, you have an ==. If you were just trying to make sure it has a value, then maybe you want issue.customfield_10077 !== null.

Thanks @ibuchanan

customfield_10077 is a single line text field. Yes, I’m trying to test whether the field is empty

I tried your suggestion and got the following

I had also tried issue.customfield_10077 != null, which gives me a “An error occurred during installation. Contact the app vendor for support.” error

The reason I’m using the ! operator is by a suggestion from @DarrylLee in this community post. In there I have a screen-shot where the not operator returns a false (boolean) value when tested with the Expression Tester app

@JavierPerez,

Excellent context! And, today I learned something about Jira expressions. I’ll try to do some research with internal engineering.

Thanks @ibuchanan !
Looking forward for your feedback