🚀 JWT 3.0 is out 🚀 

The app was completely overhauled, and so was the documentation: Jira Workflow Toolbox (Server/Data Center) Home

The page you are viewing is still valid for all app versions prior to 3.0.

On this page


Example: Limit the number of hours a user can log per day

The following configuration allows to apply a restriction on the sum of hours a user can log in a single day, counting work logs in any issue.

Enforce work logs through transitions

First we need to enforce users to log all the work using transitions in our workflows, instead of using "Log Work" operation at the issue screen. To do it we will:

  1. Remove "Log Work" from actions menu: Administration > Add-ons > Manage add-ons > Filter by "System" > Issue Operations Plugin > Disable module "View Issue Ops Bar Work Link"



  2. Create a screen with only one field: "Log Work". You can call it "Work Log in Transition".



  3. Add reflexive transition called "Log Work": in the statuses of our workflow where we want users to be allowed to log work, and we associate them the screen "Work Log in Transition", created in the previous step. These transitions have the same status as origin and destination, leaving the issue in the same status, but showing the user a screen where they will be able to log work.



    Typically you will add this transition to "In Progress" status, but you can add this transition to all statuses easily using a global reflexive transition.



    You can use conditions or validations to limit who can execute these transition, and thus who can log work.


User properties

We will use two user properties to store in order to implement this restriction. These two user properties are created and updated automatically, so we don't need to create them manually:

  • Date of Last Work Log: contains the date of the last work log done by the user. The date is stored as a number of milliseconds since fixed date.
  • Time Logged Last Day (minutes): contains the number of minutes logged by the user in the last day he has done any work logging.


Now we are ready to add validations and post-functions to transitions "Log Work", that will implement the restriction on the number of hours a user can log per day. In this particular example we will restrict the sum of hours a user can log in any issue to 12 per day:

Add Boolean Validator with math, date-time or text-string terms to transitions "Log Work" with the following configuration:


Boolean expression used is:

userProperty("Time Logged Last Day (minutes)", %{00020}) = "" OR toNumber(userProperty("Time Logged Last Day (minutes)", %{00020})) + {00141} <= 12 * 60 OR datePart({00057}, LOCAL) > toNumber(userProperty("Date of Last Work Log", %{00020})) AND {00141} <= 12 * 60

Note that:

  • %{00020} is field code for virtual field "Current user"
  • {00057} is code for numeric value of virtual field "Current date and time"
  • {00141} is code for numeric value of virtual field "Work logged in transition (minutes)"

Once validation is added, transition "Log Work" will look like this:



We will add 4 post-functions to transitions "Log Work". Now we describe each of them by execution order:

Post-function 1Set a field as a function of other fields

This post-function will store in "Ephemeral number 1" the value that should take user property "Time Logged Last Day (minutes)" after transition execution:



The 3 setting rules (one rule per line) used are:

  1. [userProperty("Time Logged Last Day (minutes)", %{00020}) = "" OR userProperty("Date of Last Work Log", %{00020}) = ""]{00141}
  2. [toNumber(userProperty("Date of Last Work Log", %{00020})) = datePart({00057}, LOCAL)]toNumber(userProperty("Time Logged Last Day (minutes)", %{00020})) + {00141}
  3. [{00141} > 0]{00141}

Post-function 2: Set or create a user property

This post-function will set (or create in case it does not exist yet) user property "Time Logged Last Day (minutes)" with the value stored in "Ephemeral number 1":



Note that:

  • %{00058} is field code for virtual field "Ephemeral number 1"

Post-function 3: Copy parsed text to a field

This post-function will store in "Ephemeral string 1" the value that should take user property "Date of Last Work Log" after transition execution:



Text to be parsed in advanced mode is:

{00141} > 0 ? datePart({00057}, LOCAL) : userProperty("Date of Last Work Log", %{00020})

Post-function 4: Set or create a user property

This post-function will set (or create in case it does not exist yet) user property "Date of Last Work Log" with the value stored in "Ephemeral string 1":



Note that:

  • %{00061} is field code for virtual field "Ephemeral string 1"

Once all the post-functions have been inserted, transition "Log Work" will look like this:




Other examples of that functions

Boolean Validator with math, date-time or text-string terms


Set a field as a function of other fields


Set or create a user property


Copy parsed text to a field