Department Filter Condition in Workflow Transition Rules

I am trying to set up a department condition to only trigger a workflow transition rule in Purchase Order.

I added a custom field to Purchase Order for Deparment and setup a custom script to filter department based on permissions:

frappe.ui.form.on('Purchase Order', {
	onload(frm) {
		// your code here
		frm.set_query('department', () => {
            return {
                filters: {

The filter works as intended but my condition seems to be failing. The condition set in the Workflow Transition is self.department_name == Shared Services to trigger workflow transition rule if this condition is met (That is, permission is set for Shared Services for users on that Role) when at that workflow state. any idea if i got something wrong?

In your workflow transition rules, try condition like

@Pawan Thanks for the tip. I used the condition as indicated in the screenshot:

However, this workflow transition rule is being triggered for other Departments even though the condition specifies only if the department Projects is satisfied.

Hi @flexy2ky have you solved this? what if I want to include the trigger the child department too?