I am struggling in workflows: HOW a specific user can be a state changer

Let’s say the following:

  • HR Manager creates a job offer, there will be only one user with “HR manager” role.
  • Employee X accepts Job Offer (and NOT role “Employee”, but must be the employee related to this job offer), there are many users with this role.

What I don’t get, that in workflow building, you can only specify specific role for every workflow state and workflow transition, but I can’t figure how to conditionally make that only “employee associated to this doctype” to receive this document and not every user with “Employee” role. Is this something that has to be a custom app thing? I prefer to use something built in.

I can’t find a single example of that anywhere, and it’s a VERY common real life scenario, It’s not possible to expect that all workflows to be all about roles and not about specific users.


One option would be to use the “Conditions” field in the workflow transitions rules table. The code below makes some assumptions about how your data is structured, but something like the following should get you close:

frappe.db.get_value("Employee", doc.employee_associated_to_offer, "user_id") == frappe.session.user