Building a Hiring Process with Dynamic Approvals
It’s no secret that Jira is just as useful for administrative processes within the company as it is for development and IT teams. It can help you to keep track of who does what by when. Whether it’s Legal, HR, or even Compliance — Jira is essential for effective workflows. And with our app Cloud Workflows, we at Jodocus aims to improve these workflows even more.
Simple hiring workflow
In this article, we would like to show you how easy it is to add approvals to a Jira Cloud workflow with Cloud Workflows. We will use an HR process as an example, but really this approach can be used to improve all kinds of workflows. Let’s take a look at a prototypical hiring workflow that applies to a specialised issue type called Hiring Candidate. Each issue represents a potential new hire and has a number of custom fields to contain additional information about the candidate. For our example we will especially look at two of those fields: The candidate’s name and future salary.
Whenever a candidate has been identified, an issue is created with the status Open. When an offer to the candidate is prepared, the status changes to Decision Pending. The next step is to send the offer out to the candidate and wait for their response. Depending on the candidate’s response the workflow either ends with Accepted or Declined. And as long as no offer has been sent to the candidate, there is also the option to cancel the hiring process.
In some cases, we want an extra approval step in this workflow. More specifically, we want an extra approval when the candidate’s salary is going to be higher than $100,000. This article will show you an easy way to set up such an approval with Cloud Workflows.
First, let us look at the specific requirements:
- Any candidate with a salary higher than $100,000 needs an extra approval
- The approval needs to be given in the form of a sub-task that is closed with the resolution ‘Approved’
- The approval needs to be in place before the offer can be sent to the candidate
Creating the approval sub-task
Requirements number one and two can be implemented with a post function that creates a sub-task. But that post function should only be triggered in some cases, so that means we need conditional execution. Fortunately, that’s easy with Cloud Workflows, here’s what it would look like:
In the example above, we assume that the salary is held in a custom field of the original issue with the id 98765
. We make Jira check whether the number in that field is higher than 100,000 and only if that is the case, the sub-task will be created.
When creating the sub-task, a few fields will be copied, but we do want to change the summary in order to make it clear what this is about. Since Cloud Workflows allows us to use templates, we set the summary to:
High salary approval for $candidate ($issue.custom_field9876543)
Which will create sub-tasks with summaries such as: ‘High salary approval for Humphrey Smith ($890.000)’ whenever an offer with an exceptionally high salary is prepared.
Ensuring that approval has been given
Before an offer is sent to a candidate, we need to be sure that an approval has been given — easy, just use the Sub-Task Blocking Condition that comes with Jira. That condition will check if there are any sub-tasks and if those sub-tasks are in a state that allows the transition. While this might work, it is prone to errors; for example an issue could have multiple sub-tasks none of which are related to the high salary approval.
So, in order to make sure that the approval requirement only applies to candidates with a salary higher than $100.000, we will build a custom condition that performs more detailed checks:
- Is the salary in
customfield_98765
above $100,000? - Is there a sub-task with a summary starting with ‘High salary approval’?
- Is that sub-task closed with the resolution ‘Approved’?
All of which can be done with this Jira Expression:
issue.customfield_98765 < 100000
||
issue.subtasks.filter(s => s.summary.includes("High salary approval"))[0].resolution.name == 'Approved'
Why would you take this approach? It makes absolutely sure that the approval process has been followed, even if one of the previous steps has failed for any reason (ex. the approval sub-task not being created or removed). Building checks like this is also essential when creating compliance processes or workflows, but that is a topic for another day.
Putting it all together
In this article we have seen how Cloud Workflows makes it so much easier to automate parts of a process by automatically creating sub-tasks for you. And we have seen how you can enforce that process restrictions (i.e. mandatory approvals) are followed without much hassle; simply by setting up a workflow condition that checks exactly the required restrictions.