Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

setFieldValue(String <field_name>or<field_Id>, Object value) method sets the value of a system or custom field of the Issue object where, 

...

You can use this method on any Issue object, such as the one provided by the issuelinkedIssue and parentIssue variables, as well as as the Issue objects returned by other methods such as getParentObject()getEpic() or getLinkedIssues().

...

  • Groovy script tester admin page: When you call this method on any Issue object passing the field name or id and field <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.
    • Example: Set the Fix Versions Version/s of the Parent from parent to the child
      • Go to the JMWE administration pages
      • Click on Groovy script tester
      • Write the following script in Groovy script

        Code Block
        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

...

  • Scripted (Groovy) operation on issue post-function: When you call this method on any Issue object passing the field name or id and field  object passing the <field_name> or <field_id> and Object value,  in Groovy script of Scripted (Groovy) operation on issue post post-function and trigger the transition on an issueEpic, the specified field gets set with to the specified value.
    • Example: Add all the reporters 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
        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

...