Restrict Workflow action emails to only creator of the document

Hello folks,

I have multiple workflow states on various doctypes in my ERPNext installation. Examples are: Approved, review requested, pending, review completed, processing etc. And for each of these states, there’s a role profile authorized to move the document status to the next state and everything works perfectly.

My issue is with the emails. Example: About 15 staff in different locations have the same role permissions on Quotations and the same role is authorized to move a document status from “pending” to “review requested” which is fine cos it enables the staff to make a change on items, prices etc

Now “user 1” creates a quote and saves, the document status moves to “pending” and an email is sent to all the staff with “approval rights” but also sent to all users with “review” rights so the staff (user 1) can make corrections to his quote before approval which is what we want cos quotes are ever changing due to customer negotiations etc.

Now my issue is this, All users (user 1 to user 15) with review rights get the email saying the document is in pending approval status and allows the option to review the document which the creator of the document is likely not intending to do

Is there a way to restrict the workflow status emails to just the creator of the document? so not everyone gets the email and we eliminate wrong review actions on documents that don’t concern them

1 Like

Hi @lams,
I think that ‘Notification’ might be best for you. The only thing I’m not sure about is how to add dropdown choice for ‘Email By Document List’ → need to look into that.
Otherwhise Notification List does what you want:
1- Select the doctype with the workflow
2- Set the ‘Send On’ = ‘Value Change’
3- set the Value Changed = Workflow
4- Set Sender
5- Add a condition (if needed) : doc.workflow==“Pending”
6- Email by document Field: owner (don’t know how to have more option here, but I know it’s possible)
7- Write a message

I Hope this will be helpful! :slight_smile:

2 Likes

Hi @mel_erp,

Thanks for this. Very helpful.

This works as I can now notify only the owner of the doc of the change in status. Now I need to figure out a way to notify the approval role of the next possible status change (for things like approve, reject, review) etc.

Also, Is there a way to insert the link to the document in the email template?

this worked - What is the code used to link to employee in email reminders? - #2 by rmehta

1 Like

@lams Inside the Workflow there’s a checkbox ‘Send Email Alert’. I think this is what you want :slight_smile:

@mel_erp Yeah, actually emails are just a part of the problem.

Actually, we began without emails, but users could still go to “workflow action” and see these documents. Even when they aren’t the creators/owners. Which is the same problem but without the email thing

So you want to restrict access to these document so only the creator can see them? In that case, Go to ‘Permission Manager’, select the doctype you wish to restrict access and check ‘Only If Creator’. If you want more control over it (like change access depending on workflow), you can write custom permission with the hook.py.

Okay.

Thanks for all your help