Add watchers from another field

Use case

Add watchers to an issue from any field, be it, for example, the Assignee or the Reporter fields.

Using this combination of functions in several transitions will enable you to add several watchers if the user of the field changes, but not to remove them.

🛠️ Configuration

Set up the custom field and the transitions that you are going to use.

Create a default User Picker (multiple users) field, and name it All watchers

Create a global reflexive transition (a transition from any issue to itself).

Set up the Update fields post function

Add a Update fields post function to any workflow transition but the global reflexive one. The Create issue transition can be a good choice here.

Target issue

Choose Current issue

Fields

Choose All watchers

Value

In the popup, choose the value Set field value manually (parser expression)

Expression

Enter the following expression :

Bash
%{union(union(toStringList(%{issue.cf10001}), toStringList(%{issue.assignee})), toStringList(%{issue.watcher}))

with parsing mode set to General and replace the field code %{issue.cf10001} with the field code for the field All watchers

As it is, the expression will take the value of the Assignee field. It could be changed for the Reporter field or for a custom User Picker field replacing the field code %{issue.assignee} with the one of your choice.

Run as

Choose Current user

Set up the Transition issue post function

Add a Transition issue post function to the same transition as the previous post function.

Target issue*

Select Current issue

Mode*

Select Execute transition

Select the transition to be executed

Select the global reflexive transition previously created.

Delayed execution

Delay the execution of the post function 1000 milliseconds .

Set up a Copy Value From Other Field post function

Add a Copy Value From Other Field Jira post function.

Source Field

Select All watchers

Destination Field

Select Watchers  

Use case Workflow function Parser functions
Set the due date based on the priority

Update fields

getMatchingValue()

Obtain the difference between two dates

Update fields


Assign an issue to the user who last commented on it

Update fields


Add three days skipping weekends automatically to a Date Picker

Update fields


Keep parent's priority in sync

Update fields


Set the assignee based on the issue type

Update fields

getMatchingValue()

Set the fix version to affects version when resolving an issue

Update fields


Use the app user to update non-editable fields

Update fields


Automatically add incident reporters to problem tickets

Update fields

append()

fieldValue()

linkedIssues()

toStringList()

Copy labels of a sub-task to the parent issue upon closing

Update fields


Assign an issue to the project lead, if the issue is unassigned on creation

Update fields


Add watchers from another field

Update fields

Transition issue

union()

toStringList()

Add a sub-task's summary and key to the description of its parent

Update fields


Set a date field to a future date

Update fields

dateTimeToString()

Record an auditable timestamp of a Compliance Approval

Update fields

dateTimeToString()

Copy field values from epic to issues under it after creation

Update fields Transition issue

epic()

issuesUnderEpic()

filterByStatus()

Set a date field to the current date

Update fields

dateTimeToString()

Assign important issues to the project lead

Update fields


Set the priority to Highest if the 'Infrastructure' component is selected

Update fields


Background priority calculation

Update fields

avg()