Breadcrumbs

Priority assessment based on field values

πŸ“š

Return a number that defines the priority of a work item based on the values of certain fields. If one of the field contains one of the defined values, the total number will increase by one.

Configuration

Create a Custom smart number field and use the General parsing mode.

Expression

%{sum([%{issue.cfnnnnn} = "Option 1" ? 1 : 0, %{issue.cfppppp} = "Option 2" ? 1 
: 0 ])}

Please, replace nnnnn and ppppp with the IDs of the custom fields, e.g. Select List (single choice).

Format

Default

Used parser functions

The links lead to the JWTC documentation because the parser functions are shared functionalities.

Details

1. What does the expression do?

This expression calculates a priority score for a work item by checking the values of specific custom fields. For each field that matches a defined value, the score increases by one. The final result is a number representing how many of the specified conditions are met.

2. Step-by-step breakdown

The expression is:

%{sum([%{issue.cfnnnnn} = "Option 1" ? 1 : 0, %{issue.cfppppp} = "Option 2" ? 1 : 0 ])}
  • %{issue.cfnnnnn} and %{issue.cfppppp}: These refer to custom fields on the work item. You need to replace nnnnn and ppppp with the actual IDs of your custom fields.

  • = "Option 1" and = "Option 2": These check if the field values match "Option 1" or "Option 2".

  • ? 1 : 0: This is a conditional (if-then-else) statement. If the field matches the specified value, it returns 1; otherwise, it returns 0.

  • [ ... ]: The square brackets create a number list with the results from each condition.

  • sum([...]): This function adds up all the numbers in the list, giving you the total number of conditions that are true.

3. Examples

Suppose you have two custom fields:

  • Field A (ID: 12345), value: "Option 1"

  • Field B (ID: 67890), value: "Option 3"

The expression would look like:

%{sum([%{issue.cf12345} = "Option 1" ? 1 : 0, %{issue.cf67890} = "Option 2" ? 1 : 0 ])}
  • Field A matches "Option 1" β†’ returns 1

  • Field B does not match "Option 2" β†’ returns 0

Sum: 1 + 0 = 1

4. Real-life use cases

  • Priority Scoring: Automatically assign a priority score to work items based on key field selections (e.g., if certain risk factors or categories are selected).

  • Eligibility Checks: Count how many criteria a work item meets for a specific workflow or process.

  • Custom Reporting: Use the score to filter or sort work items in dashboards or reports, highlighting those that meet more important conditions.