Forums

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

Set a custom field value[Script Runner]

arno
Contributor
November 27, 2023

Hi All

Recently, I used Script Runner to set the value of a custom field, and no error was displayed when I set it. When I tested and verified it, the following error was displayed

"Error occurred while creating issue. This could be due to a plugin being incompatible with this version of JIRA. For more details please consult the logs"

My code is as follows:


import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.customFieldManager
def custom_field = customFieldManager.getCustomFieldObject('customfield_14015')
issue.setCustomFieldValue(custom_field,"test")
This is a single field, I used a similar method before, set the text field, is normal, the corresponding code is as follows

import com.atlassian.jira.component.ComponentAccessor

def customFieldManager = ComponentAccessor.customFieldManager
def link = customFieldManager.getCustomFieldObject('customfield_14007')
def url = "www.test.com"
def key = issue.key
def k =key.toString()
def web = url + k
issue.setCustomFieldValue(link,web)
Is it because the custom fields are inconsistent, so you can't use this method to set field values
My Jira version: 8.13.3
Plug-in version: 6.51.0

1 answer

0 votes
Florian Bonniec
Community Champion
November 28, 2023

Hi @arno 

 

This example may help you solve your issue.

 

Update the Value of Custom Fields through the Script Console - Adaptavist Library

 

Regards

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events