Hello, my colleague and I are trying to set up a multi user approval to give their nod before an issue can proceed through the workflow. We have seen a couple different ways of doing this but are struggling to make any work.
We have the scriptrunner extension and are on a company managed project.
We need have one person for each department to give their approval, ie. finance, after sales, engineering etc.
Ideally we would want this to use a field with a checkbox next to each name.
Please Help :) We're going round in circles
Hello, @Izzy Clatworthy !
I noticed that you are currently using Scriptrunner, but I wanted to introduce you to an alternative developed by my team - Business Process Manager. This add-on offers a no-code solution for creating multi-step approval workflows and setting workflow transitions with action items. With BPM, you can save and reuse various workflow templates, leveraging dependencies and scheduling for added efficiency.
If this sounds interesting to you, please let me know. Thank you for your attention!
A set of tickboxes is going to be really hard to work with, and you would need to set it up such that every approver was an option.
Assuming you are doing the approval by having a workflow action for "approve", then I would use either a multi-user-select list, or a set of single-user-select-lists, one for each department.
Then you can use a script like https://library.adaptavist.com/entity/calculate-custom-field-on-issue-update?tab=cloud to update it with the name(s) of the approver.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Izzy Clatworthy ,
Your solution should be something like :
Go to Jira Administration and navigate to the "Issues" section.
Under "Custom Fields," create a new Checkbox field, such as "Department Approval."
Configure the field to have checkboxes corresponding to each department involved in the approval process (e.g., Finance, After Sales, Engineering).
Define Workflow Transitions:
import com.atlassian.jira.component.ComponentAccessor
// Define the required departments
def requiredDepartments = ["Finance", "After Sales", "Engineering"]
// Get the issue and custom field manager
def issue = issue
def customFieldManager = ComponentAccessor.getCustomFieldManager()
// Get the Department Approval field
def departmentApprovalField = customFieldManager.getCustomFieldObjectByName("Department Approval")
// Check if all required departments have approved
for (String department : requiredDepartments) {
def departmentValue = issue.getCustomFieldValue(departmentApprovalField)?.toString()
if (!departmentValue?.contains(department)) {
return "Error: $department approval is required."
}
}
This script assumes that the checkbox field for department approval is named "Department Approval." Modify it accordingly if you have a different field name.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you very much for getting back so quickly @Frederik Vantroys
Is there anyway for locking that to specific users?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can play with the script.
Maybe something like :
import com.atlassian.jira.component.ComponentAccessor
// Define the specific users from each department
def financeApprover = "finance_user"
def afterSalesApprover = "aftersales_user"
def engineeringApprover = "engineering_user"
// Get the issue and custom field manager
def issue = issue
def customFieldManager = ComponentAccessor.getCustomFieldManager()
// Get the Approver field
def approverField = customFieldManager.getCustomFieldObjectByName("Approver")
// Get the value of the Approver field
def approverValue = issue.getCustomFieldValue(approverField)?.username
// Check if all specific users have given their approval
if (approverValue != financeApprover || approverValue != afterSalesApprover || approverValue != engineeringApprover) {
return "Error: Approval from all departments is required."
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Frederik Vantroys I'm having issues with the code, it's throwing up errors because we use a Jira cloud than a jira Server.
It in particular doesn't like that first import line
Thank you in advance
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm afraid that answer was written by an AI that doesn't understand Cloud and DC are different things, and has of course, completely ignored your "Cloud" tag.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.