Clone wiki

JIRA Workflow Toolbox / post-functions / Copy Parsed Text to a Field

./img/moved.png

Purpose

Copy a parsed text to a field post-function is a general purpose tool for setting almost any kind of field (text, select, radio button, multi-select, checkboxes, cascading select, multi-cascading select, user, multi-user, dates, date-time, number, etc). Although, in the case of field types Number, Date, Date-Time and Priority (when using associated numeric value) it’s usually preferable to use post-function “Mathematical and date-time expression calculator“, since you can enter complex math and time expressions.

Parsing modes

This post-function provides 2 parsing modes:

  • Basic: in this simple parsing mode you can write free text and insert field codes with format %{nnnnn} or %{nnnnn.i} anywhere in your text. These field codes will be replaced at execution time with the string field values of the corresponding fields.
  • Advanced: This is the new parsing mode that was been introduced in version 2.1.18. It requires the text to be parsed to be written as a text-string expression respecting strictly the parsers grammar, otherwise you will get an parsing error. The new mode allows to insert math and time formulas, and text formatting function calls (trim, toUpperCase, toLowerCase, replaceAll, etc), making it much more powerful than the basic mode.

    Automatic parsing mode converter: You can write your text in basic mode, and then switch to advanced mode. The text to be parsed will be automatically rewritten as a text-string expression. Now you can simply make the modifications you require, making use of text formatting functions, or inserting math or time expressions where needed.

This screenshot shows the new screen configuration of this post-function:

Copy parsed text configuration screen.

Text to be parsed in the example is: "Current issue has key" + %{00015} + ", was created by " + %{00005} + " on " + %{00009} + ", and its Summary in uppercase is \"" + %{00000} + "\"."
Note that:

  • %{00015} is field code of Issue key.
  • %{00005} is field code of Reporter's full name.
  • %{00009} is field code of Date and time of creation.
  • %{00000} is field code of Summary.

    You can use this post-function for the following purposes:

1. Composing dynamic text by inserting field values:

Composing dynamic text by inserting field codes with format %{nnnnn} among text string literals. These field codes will be replaced at transition execution with the values of the corresponding fields. The resulting text will be copied into Target field.

  • Example: At issue creation, we want to automatically create a comment with a custom text.

    Copy parsed text configuration screen.

    Once configured, transition will look like this:
    Copy parsed text post-function once configured.

2. Setting or updating the value of any type of custom field or virtual field:

This is a very versatile feature that allows you to set the value of any custom field or issue feature in almost any way you may require.

2.1 Setting custom fields:

Field typeExpected values and format when setting the field by a post-functionExamples
CheckboxesComma separated list of options to be selected. Admits + and - prefixes to add and remove single items.blue, red, white

+ blue

-red, white
Radio ButtonsName of the choice to be selected.
Select List (single choice)Name of the choice to be selected.
Select List (multiple choices)Comma separated list of options to be selected. Admits + and - prefixes to add and remove single items.blue, red, white

+ blue

-red, white
Select List (multi-level cascading)Multi-Level Cascading Select add-on supported: comma separated list of values for each level of the cascade.America, USA, California, San Francisco
Text Field (single line)Text value (any other type will be cast to text)
Text Field (multi-line)Text value (any other type will be cast to text)
Labelsspace separated list of labels. Admits + and - prefixes to add and remove single items.web crm question

+ web crm

- question
Group Picker (single group)Name of a group.Administrators
Group Picker (multiple groups)Comma separated list of group names. Admits + and - prefixes to add and remove single items.Administrators, Developers, Users

+ Administrators

- Developers, Users
User Picker (single user)Name of a user name (not full name) or name of a project role. Add-ons supported: Issue Alternative Assignee, User Group Pickerjohn
User Picker (multiple users)Comma separated list of user names (not full names), name of a group (every user in the group will be set), or name of a project role (every user in the project role will be set). Admits + and - prefixes to add and remove single items.john, mary

Developers

+ john

- mary, Administrators
Version Picker (single version)Version name.1.0
Version Picker (multiple versions)Comma separated list of version names. Admits + and - prefixes to add and remove single items.1.0, 1.1, 2.0

+ 1.0, 1.1

- 2.0
Project Picker (single project)Project key or project name.CRM

Customer Relationship Management
Issue PickerIssue Picker add-on supported: comma separated list of issue keys. Admits + and - prefixes to add and remove single items.CRM-1, CRM-12, HR-254

+ CRM-1, HR-254

- CRM-12
SpringJIRA Software's Spring field can be set by writing on it the numerical ID of a Spring.Sprint's numeric ID can be obtained by moving the mouse pointer over some controls of JIRA UI as shown in this screenshot.

Requires version 2.2.28 or higher.
Customer Request TypeJSD's Customer Request Type field can be set by writing on it a Request Type's key.Request type keys can be obtained by executing "Copy a parsed text to a field" post-function for writing the value of a field Customer Request Type with different values.

A Request Type key begins by a project key followed by /.
The default Request Type keys for a project with key ISD are:
- Report a system problem: isd/systemproblem
- Get IT help: isd/getithelp
- Fix an account problem: isd/accountproblem
- Get a guest wifi account: isd/guestwifi
- Set up VPN to the office: isd/vpn
- Request admin access: isd/adminaccess
- Request a new account: isd/newaccount
- Onboard new hires: isd/newhires
- Desktop/Laptop support: isd/compsupport
- Set up a phone line redirect: isd/phoneredirect
- Request new software: isd/newsoftware
- Request new hardware: isd/newhardware
- Upgrade or change a server: isd/upgradeserver

Requires version 2.2.28 or higher.
"Account" and "Team" TEMPO Timesheet's custom fieldsValues used for setting these fields are internal numerical IDs. These Ids can be found out moving the mouse pointer over links relative to accounts and teams and looking at the related URLs.
Since version 2.2.26 field Account can also be ser using a string value with the name or the key of the account.
When field Account is not set the value returned is -1 (versions of TEMPO Timesheet earlier than 8.0), or null (TEMPO Timesheet 8.0 or higher).
1

2

11


Note: All the examples above are shown in double quotes for readability, but if you are using basic parsing mode you should remove them.

2.2 Add or remove Single Items or Subsets of Items from Multi-valued fields (using prefixes + or -):

Syntax specification:

  • + comma_separated_list_of_values : adds a set of values to the ones currently set in a multi-valued field.

2.3 Set value of Selectable or Multi-Valued fields by Regular Expressions:

Fields will be set with all valid options or items available for it that fulfills a certain regular expression (syntax: "/regexp/"), or not fulfilling it (syntax: "//regexp/"):

2.4 Change Issue Features: (more details at Virtual Fields)

  • Summary
  • Description
  • Assignee
  • Environment
  • Reporter
  • Priority
  • Resolution
  • Issue status: executes transitions in workflow to move issue to written status.
  • Issue status (delayed writing): same as Issue status, only that waits for current transition to finish execution.
  • Execute transition: expects the name of a transition, and executes it if all the conditions and validations are satisfied.
  • Execute transition (delayed execution): same as Execute transition,only that waits for current transition to finish execution.
  • Attachments (current attachments will be replaced): writing issue keys on this field will make attachments from those issues to replace current attachments.
  • Attachments (only new attachments will be added): writing issue keys on this field will make attachments from those issues to be added to current issue.
  • Last comment: it overwrites the last comment of the issue.
  • Last comment's visibility restrictions: it set the visibility for the last comment of the issue. It expects the name of a group or of a project role.
  • New comment: adds a new comment to the issue with no visibility restrictions. It expects the text of the comment.
  • Labels: it overwrites the labels for the issue. Prefixes + and - can be used for adding or removing single labels.
  • Components
  • Affected versions
  • Fixed versions
  • Security level
  • Watchers: it overwrites the current watchers of the issue. It expects a comma separated list of user names.
  • New watchers: it expects a comma separated list of user names, and makes them watchers of the issue, maintaining current watchers.

2.5 Set Numeric and Date-Time fields: (more details at Virtual Fields)

  • Due date
  • Original estimate (minutes)
  • Remaining estimate (minutes)
  • Total time spent (minutes)
  • Add to time spent (minutes): adds the number of minutes written into this field to the current work log of the issue.
  • Date picker
  • Date and Time picker
  • Number custom fields

    Fields introduced by plugin JIRA Misc Custom Fields are also supported.

    Although it's possible to set numeric and date and time fields with post-function copy parsed text, it's much better to use post-function “Mathematical and date-time expression calculator“, which allows to do complex mathematical and time calculations.

Combining with other post-functions:

You will often use "Copy a parsed text to a field" in combination with other post-functions, like "Write field on linked issues or subtasks", "Write field on issues returned by JQL Query or Issue List" and "Set a field as a function of other fields."

You should select an Ephemeral field in parameter Target field, in order to hold a temporary parsed text that will be used by the next post-function. In the case of post-functions "Write field on linked issues or subtasks" and "Write field on issues returned by JQL Query or Issue List" the resulting parsed text stored in an ephemeral field will be written into a field in other issues (linked issues, transitively linked issues, subtasks, sibling subtasks, or any issue returned by a JQL query).


Usage Examples

Related Features

Updated