Forums

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

ScriptRunner: How to set CustomFieldValue?

dD
Contributor
October 4, 2021

Unbenannt.GIF

Hello Community,

please enlight me... I want to create new Issues (using mutable issues) and set the value for an CustomField equal to the value of a variable. But it will not work! I used the following code for mutable issues:

void setCustomFieldValue(CustomField customField,
                         Object value)

But it doesnt accept my variable as valid value. How can I change that?

 

If you need more context: I used a jql to find issues of an issuetype. For every found issue I want to create a new Issue of another  issuetype and copypaste the values of the customfields from the old issue. 

1 answer

1 vote
Nic Brough -Adaptavist-
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.
October 4, 2021

You are creating new variables in the parameters when you are saying "type name" (object value and customfield customfield)

You should be just passing the variables that you've already created into the call, not creating new objects.  Remove the type definition bits in the call.

Suggest an answer

Log in or Sign up to answer