setFieldValue(String <field_name>or<field_Id>, Object value)
method sets the value of a system or custom field of the Issue object where,
<field_name
> is the name of the field as displayed in the Field configuration<field_id>
is the ID of the field as shown in Accessing the Jira Standard fields of an issue document. In the case of a custom field, it has the form customfield_xxxxx
, where xxxxx
is the custom field numerical ID, as seen in the URL when viewing or editing the field.Object value
, is the value which is same as what is expected to be returned as the result of a Groovy expressionYou can use this method on any Issue
object, such as the one provided by the issue
, linkedIssue
and parentIssue
variables, as well as the Issue
objects returned by other methods such as getParentObject
()
, getEpic()
or getLinkedIssues()
.
Method availability:
This method is allowed only in scripts run from the
<field_name>
or <field_id>
and Object value
, in Groovy script
of the Groovy script tester page and test it, the specified field gets set to the specified value. This is useful when you want to just set a field value without the need to trigger any transition or add a post-function.Write the following script in Groovy script
parentIssue.setFieldValue("Fix Version/s",issue.get("fixVersions")) |
Click on Test Groovy script
from the toolbar
Issue key
on whose parent you wish to set the value Test
The Fix Version/s will be set to that of the child.
<field_name>
or <field_id>
and Object value
, in Groovy script
of Scripted (Groovy) operation on issue post-function and trigger the transition on an Epic, the specified field gets set to the specified value.Write the following script in Groovy script
Set users = [] issue.stories.each{ users += it.get("reporter") } users += issue.get("watches") issue.setFieldValue("watches",users) |
Publish the workflow
Write the following script in Groovy script
issue.setFieldValue("description","Create a document for the fix : ${issue.key} - ${issue.summary}") |
Publish the workflow