Skip to end of banner
Go to start of banner

Copy Value From Other Field Post Function

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 62 Next »

JSU for Jira Server/Data Center

This is the documentation of JSU for Jira Server/Data Center. If you are using JSU on Jira Cloud, see our JSU Cloud documentation.

Description

The ‘Copy Value From Other Field’ post function copies the value of one field to another field. You can configure any number of source/destination field pairs. You can also use this post function to copy from/to comments. The copy operation can be performed within the same issue or to/from a related issue.

Configuration

You must specify the relation between the source and destination issues for the field to copy. Then you can add any number of field pairs to perform the copy operation.

Precondition

If you are using preconditions with a JSU post function, you can use the following options to define how the precondition is evaluated:

  • Ignore precondition (default): Every precondition is ignored which means that the post function will always be performed

  • True: Precondition must be true to execute a post function

  • False: Precondition must be false to execute a post function

Issue Relation

Several of JSU's post functions let you define the scope for some related issues.
For example, instead of copying a field within an issue during a post function, you might choose to copy it to a subtask.

Types of Issue Relations

Portion of a post function configuration page showing the options described on this page.

The related issue is determined by one of the following Jira concepts:

  • Issue Link
    You can define the link type to define which issues will be affected by the post function action.
    You can define ANY if you want the action to be performed on any linked issues.

  • Parent / Sub-Task
    The related issue is either the parent or subtask of the origin issue.

  • Epic / Issue in Epic
    The other issue is either the epic, related by an epic link, or it is part of an epic. This is only available if you have Jira Software installed.

  • JQL
    A JQL query can be used to find the issues that will be affected by the post function. You can use placeholders in the JQL query that will be replaced with the current field values of the issue in transition.

    Portion of the post function configuration page that shows the JQL query input box.

    For help with writing the JQL query, see the instructions on JQL Reference. See our JQL Use Cases for some examples.

Issue in Transition

Issue in Transition refers to the issue for which a workflow condition is checked, a workflow validator is examined, or a workflow post function is performed. It is the issue that triggered a workflow condition/validator/post function to be executed.

Source and Destination

Some post functions, for example, the Copy Value From Other Field post function allow you to define the issue in transition as the source or destination of the copy operations, while you define the other end with an issue relation. The field value will then be read from the source issue and be written to the destination issue.

Other workflow modules do not have source and destination; you define the issue relation that will apply to that workflow module. For example, Create a Linked Issue will just create a new issue and then connect it with some Issue Relation to the issue in transition.

Restrictions

  • Copy Value From Other Field post function: there should be only one source issue. Otherwise, it is not clear from which the value will be read. (The current implementation will just randomly pick one of them and ignore the rest.)

  • If you use Create a Linked Issue to create a new sub-task, you must also configure this post function to create the new issue as an issue type of a sub-task and make sure the target project is the same as the one of the issue in transition.

Some of these restrictions are mentioned as 'must be' within the options to configure the issue relation.

In case of problems, the workflow module will still run but a message is entered in the log file. See Troubleshooting for how to turn on the full logging for JSU. This is recommended while you test any new workflow configuration.

Perform As User

When choosing a user account to run a post function, the account specified must have the appropriate permissions to perform the actions of the post function, for example, creating an issue or adding a comment. You can specify a different user account that owns the necessary permissions that acts only as a technical (impersonation), with broad permissions, but not used to log in to a Jira account as an individual. 

If you don't specify a user here, the transition on the related issue is performed as the same user who triggered this post function on the origin issue by default. Therefore that user must have the necessary permissions on the related issue. In some setups, that user might not have the required permissions on the related issue or even access to the project of the related issue.

In combination with the User is in Any Users condition, you can hide a transition from all users other than the 'Perform As User' user.

Copy Fields

JSU’s Copy Value From Other Field and Create a Linked Transition post functions allow you to define multiple copy value pairs from a source field to a destination field. 

The Add Field button highlighted in the Copy Value Field post function.

Not all conversions from source to destination field are supported, nor feasible. The copy function works if the source and destination fields are of the same field type, or if the destination field is a text field. Some additional combinations will also work, however, they are not officially supported.

Overwrite / Append / Prepend

For text fields and some fields that can accept multiple values, for example, checkboxes, you can choose to overwrite, append or prepend the new value to any existing value. For a text field, you can also choose a separator that will be placed between the values.

Create version if necessary

If your origin issue has a version, it can be copied to the linked issue.

If the destination field is 'Fix Version/s', 'Affects Version/s' or a custom field of type 'Version Picker', you can choose to create a new version in the target project, if it does not yet exist. If you don't select this option and that version does not yet exist, an error message will be displayed to users and the transition won't complete.

The new version will be created even if the user does not have the Administer Projects permission. (Normally a user needs that permission to be able to create a new version.)

Special 'Sources'

  • *** default value ***The default value of the destination field will be set.

  • *** empty ***The destination field will be set with the empty string value. When overwriting a field value, the resulting destination value will be null. When appending/prepending a field value, the resulting destination value will be the concatenation of the existing field value (if any) and the separator. If the aim is to clear the destination field value, use JSU’s ‘Set Any Field Value’ or ‘Clear Field Value’ post function. (See: Post Function Concatenation Operations)

  • *** transition comment ***Use the comment that the user entered on the transition screen.

  • *** last comment ***Use the last (most recent) comment on the issue before the transition was started.

Special 'Destinations'

  • *** new comment ***Create a new comment with the value from the source field.

  • *** new internal note ***: Create a new internal note with the value from the source field (Jira Service Management only).

A new internal note is created only for Jira Service Management (JSM) project issues. For non-JSM projects, a regular comment is created with the value from the source field.

See the note about supported field types below.

Position of the post function 

Jira transitions include essential post functions that are executed in a specific order. When adding JSU post functions to a transition, it is important to position the post function with respect to the essential post functions.

‘Create’ transition

The ‘Create' transition is the first transition, which does not have a source status (only destination status - usually Open).

If you add the ‘Copy Value From Other Field’ post function to the ‘Create’ transition, you should generally position it before the ‘Creates the issue originally’ post function.

Specific field types
If the ‘Copy Value From Other Field’ post function applies to any of the following fields, position it after ‘Creates the issue originally’ and before ‘Re-index an issue to keep indexes in sync with the database’.

  • Watchers

  • Labels

  • *** new comment ***

 Click here to see an example for the Create transition configuration


Exception for Copy Value From Other Field used on the Create transition to populate value from linked issues

If you use the ‘Copy Value From Other Field’ post function in the ‘Create’ transition and you would like to copy values from a linked issue (Issue Linking: Issue in Transition = Source, Issue Linking: Issue in Transition = Destination, Parent / Sub-Task, Epic / Issue in Epic), the post function must be placed after 'Creates the issue originally'. An issue has to be first created, then a relation between these linked issues is established.

Any other transition (not ‘Create’)

Place the ‘Copy Value From Other Field’ post function anywhere before the "Update change history for an issue and store the issue in the database." post function.

Example

A workflow is configured so the ‘Resolve’ transition has the ‘Copy Value From Other Field' post function. The post function is configured to copy the value of the ‘Assignee’ field to the 'TextField’ field. If a user resolves an issue on this workflow, the value of the 'Assignee' field will be copied to the 'TextField' field after the issue is resolved.

Supported field types

JSU supports many different field types such as system fields and custom fields. However you should be aware, that not all field types are supported, and not in all combinations. We aim to cover the most important field types and are continuously adding and improving how different field types are supported. Some custom fields of other third-party apps might never be supported. You should always test anything you do with issue fields with JSU. You can try it with a free 30-day evaluation license.

  • No labels