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
TAGS
atlassian, jira cloud certification, managing jira projects, jira project administration, jira cloud exam, atlassian certification, agile project management, jira workflows, jira permissions, jira training, jira cloud skills, atlassian learning

Become a Certified Jira Service Project Expert 🦸🏻‍♂️

Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.

Get Certified! ✍️
AUG Leaders

Atlassian Community Events