Skip to main content

Purchase Approval during On-Boarding

Problem

Imagine you track all purchases that need to be done for a new-hire as individual sub-tasks to an on-boarding issue. While you want the team to just go ahead and buy what they believe is needed most of the time, once a certain overall threshold (say $100.000) is reached, you’ll want the hiring manager to approve further costs. The sub-tasks have a custom field that hold the price of each individual purchase, while the on-boarding issue itself holds the hiring manager in another custom field.

Solution

You can do this either with a condition or a validator. In either case, add a custom condition (validator) to the transition that starts work on a story and use the following Jira expression, assuming that customfield_10044 is the price and customfield_10058 is the hiring manager:

issue.subtasks
  .map(n => n.customfield_10045)
  .reduce( (a, b) => a + b,0) < 10000 ||
user.accountId ==
  ( issue.customfield_10058 ? issue.customfield_10058.accountId : null )