Forums

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

Getting a identifier not available in context error for cfValues in a ScriptRunner validation

Cash Coyne
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.
December 29, 2023

I am using Jira Cloud and trying to use a ScriptRunner Validation in a workflow.

I am using this script:

cfValues['Acceptance Criteria'].length > 10

But when I do, I get this error:

Evaluation failed: "cfValues" - identifier not available in context

In the ScriptRunner docs, it shows numerous examples using cfValues[].  What am I missing?

ScriptRunner cfValues Error.jpg

1 answer

0 votes
Cash Coyne
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.
December 29, 2023

After much searching around, took a different approach based on some code found in the jira-expressions-type-reference doc and this works:

let plainTextValue = value => typeof value == 'Map' ? new RichText(value).plainText : value ;
(issue.customfield_10227 != null) && (plainTextValue(issue.customfield_10227).length > 10)

But I'd still like to know why cfValues throws an error because it seems like a much more straight forward way.

Suggest an answer

Log in or Sign up to answer