Custom Notification alert

Hello everyone,

In my case 2 to 3 users are responsible to submit purchase invoice with different roles,Project manager, Project Coordinator, Accounts. So, I need to send them a notification/alert whenever a document reaches to their respected workflow state, (for e.g= sent notification/email to project manager when the Purchase invoice is in Submitted for Project Manager state, same goes for others). It will remind them to look at the Invoice and approve them accordingly.

If have any solution please help.
Thank You

Please check the reference.

Hi @NCP
I tried but didn’t applied the settings yet, (Tried earlier but emails sent to all pm and pc) i have another issue, As i mention we do have different roles like Project managers, Project coordinators, and i gave them access to particular projects only so whenever a supervisor uploads a Invoice it’s visible to only those project manager which are assigned to the same Project, so if i enable the notifications alert then all the project managers will receive all invoices details which are in workflow state= submitted for PM Approval.

I want if a purchase invoice is in PM approval state then only those Project managers receive the notifications which have the access of the same project mentioned in the Purchase invoice.

Thank You

I want that

@NCP
i got this code from gpt , don’t know is that correct or not

Assuming project_manager_assigned_to_project() is a function that returns the project manager assigned to a given project

project = purchase_invoice.project # Assuming purchase_invoice has a property ‘project’ representing the project associated with it

if doc.workflow_state == “Submitted for PM Approval”:
project_manager = project_manager_assigned_to_project(project)
send_notification_to(project_manager)

elif doc.workflow_state == “Submitted for PC Approval”:
project_coordinator = project_coordinator_assigned_to_project(project)
send_notification_to(project_coordinator)

Thank you