Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

cfValues in script runner

Bunty February 7, 2019

Hello All,

we have two workflows for two issue types. Task to is to created two sub tasks when a parent issue got created based on custom feild selection.
I have added the below code in the Script Runner :-
cfValues['11906']?.value == 'Bug' || cfValues['11906']?.value == 'Enhancement'

This code is working for first issue type and not working for the second issue type. Custom Field names are different for both the issue types.
I printed the logs, from the logs i understoond that "cfValues" has customfields related to first issue type only.

2019-02-08 03:34:55,704 WARN [utils.LazyCustomFieldsMap]: Did not find requested custom field 11906 on issue MTS-1564
2019-02-08 03:34:55,711 WARN [utils.LazyCustomFieldsMap]: Did not find requested custom field 11906 on issue MTS-1564

Can you please suggest that how to get proper cfValues when second issue type's workflow gets executed.

 

THanks in Advance,

Bunty

1 answer

Suggest an answer

Log in or Sign up to answer
1 vote
Cornelius Gillner March 4, 2022

Just stumbled upon this older question.

cfValues is a map-like structure where you can get the value of any custom field on the object. Note that the keys are the field name, and not id.

 You will have to access the field value by its name, the name like you will find it in the administation for custom fields in Jira.

cfValues['nameOfField'] == 'Bug' || cfValues['nameOfField'] == 'Enhancement'

try this.

TAGS
AUG Leaders

Atlassian Community Events