Discrepancy between Jira Expression API and Workflow Validator for Text Field (multi-line)

I currently have a workflow validator which ensures that my custom field contains a certain amount of characters.

My validator expression is

issue.customfield_10037.length > 1

I have found that when using the eval rest API to validate my validator logic it returns a 400 response

{"errorMessages":["Evaluation failed: \"issue.customfield_10037.length > 1\" - operator \">\" is not applicable to types: null and Number"],"errors":{}}

However when I save the validator it functions as expected.

It appears that there may be a discrepancy between the expression API and the expression framework used within Jira for Multi line text fields. Is this a bug with the expression API?


1 Like

Hi, could you show what the REST API returns when you evaluate issue.customfield_10037? Ideally, both when you would expect the condition to be true, and false. What’s the type of this field? Could you show information about it obtained from GET /rest/api/2/field?

Hi Ben,
this is because the custom field was empty on the issue against which you tested your expression. You need to test for that:

issue.customfield_10037 && issue.customfield_10037.length > 1


I can indeed


The type of the field is a ‘Text field (multi-line)’ and the Fields API describes it as

        "id": "customfield_10037",
        "key": "customfield_10037",
        "name": "Multiline field",
        "untranslatedName": "Multiline field",
        "custom": true,
        "orderable": true,
        "navigable": true,
        "searchable": true,
        "clauseNames": [
            "Multiline field",
            "Multiline field[Paragraph]"
        "schema": {
            "type": "string",
            "custom": "com.atlassian.jira.plugin.system.customfieldtypes:textarea",
            "customId": 10037

So with the condition I’d expect it to evaluate to true if the number of characters within the field is greater than 1


Hi David,

Unfortunately in this scenario that doesn’t seem to be the case! But thank you for the suggestion!

Ah, so multi-line fields work differently in different versions of the REST API. You must be using v3 – switch to v2 and the results will become as expected. I.e. instead of calling “/rest/api/3/expression/eval”, call “/rest/api/2/expression/eval”.


Good catch @kkercz !
I never think of that, we only use the V2 API since the V3 API is still in beta… and also unusable for rich text because templated manipulation of rich text in the V3 API is next to impossible.

1 Like

Ahh right! That sorts it thank you! :smiley: