setFieldValue(String <field_name>or<field_Id>, Object value)
method sets the value of a system or custom field of the Issue object where,
...
- Groovy script tester admin page: When you call this method on any Issue object passing the
<field_name>
or<field_id>
andObject value
, inGroovy 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.- Example: Set the Fix Version/s of the parent to the child
- Go to the JMWE administration pages
- Click on Groovy script tester
Write the following script in
Groovy script
Code Block language groovy linenumbers true parentIssue.setFieldValue("Fix Version/s",issue.get("fixVersions"))
Click on
Test Groovy script
from the toolbar- Select the child
Issue key
on whose parent you wish to set the value - Click on
Test
- Go to the parent issue
- Example: Set the Fix Version/s of the parent to the child
...
- Scripted (Groovy) operation on issue post-function: When you call this method on any Issue object passing the
<field_name>
or<field_id>
andObject value
, inGroovy 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.- Example: Add all the Reporters of the stories as the Watchers of the Epic
- Add the post-function to a transition
Write the following script in
Groovy script
Code Block language groovy linenumbers true Set users = [] issue.stories.each{ users += it.get("reporter") } users += issue.get("watches") issue.setFieldValue("watches",users)
Publish the workflow
- Trigger the transition on the Epic
- Example: Add all the Reporters of the stories as the Watchers of the Epic
...
- Example: Set the description of the issue with the summary and issue key
- Add the post-function to a transition
Write the following script in
Groovy script
Code Block issue.setFieldValue("description","Create a document for the fix : ${issue.key} - ${issue.summary}")
Publish the workflow
- Trigger the transition on the issue
- Example: Set the description of the issue with the summary and issue key