The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

cfValues in script runner

Bunty
Contributor
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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Cornelius Gillner
Contributor
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