Custom Email Alert with Workflow Action

Can anyone guide me on how include workflow action in my custom email alert? I desperately need this and would appreciate any guide i can get. Thanks.

I am assuming that this line is what i need to call up the workflow action.

apply_action_method = "/api/method/frappe.workflow.doctype.workflow_action.workflow_action.apply_action"

How do i put this in my custom email alert to call up the Workflow Action? Would appreciate any help here.

Have you tried this?

@nabinhait yes i have. Emails don’t get generated even after using that. In fact everything was working as intended until v12.5.0 was released last week and what i suspect is This PR broke workflow email alert. Now Email alerts don’t get generated from workflow even when i use the template or allow the default template.

I reported it in this thread but so far no word on if and when it will be looked into and/or fixed. I am left frustrated as my workflows now sit without approvals because approvers don’t get notified that they have workflow actions awaiting approval and/or have to login to to approve which is difficult because most are in the field and are pressed for time to check every time. This has a severe negative effect on business processes at the moment so i am looking for solutions or workaround to this issue.

1 Like

Can anyone advise what is this table Workflow Action good for except for sending email via Nofitications List ?

We’ve traced the code and found absolutely no idea the purpose of this Workflow Action and it has been the main cause for the entire system to slow down. Over the years, this table is currently the largest in size and has generated over 8 million rows on the db.

We’re tempted to clear the table but not sure what repercussions will arise from clearing it.

Anyone can enlighten us if we can clear this table?

IF we comment out the code that inserts/write/update the tabWorkflow Action table, the system seems to be running fine, and the DB server would not be running at 100% CPU entire time.

The moment we uncomment the line of code , the MARIADB server would return to running at 100% CPU consumption.

Please help us out with this.

Same problem here. Not sure if that’s what has led to this pr: perf: Index workflow action by hasnain2808 · Pull Request #13763 · frappe/frappe · GitHub

PR created also: Workflow State inserts a massive amount of data to workflow table on each request. · Issue #13784 · frappe/frappe · GitHub

I also commented-out the “insert into tabWorkflow Action” code since I’m not using email notification.
So far no impact on our process.
ERPNext & Frappe 12.x

The context would be that the role that is assigned to the workflow action would have lots of users within, this is how the number of inserts will increase.

Hey
Whenever a workflow gets triggered, for each person who gets the option to do an action a workflow action document is created. Once a user completes the action all records of other users are deleted and the document for this user is updated.

This is not what we noticed, the table is constantly being inserted with new rows and updated heavily but never delete.

To the extent that sometimes when we create new USER account, the account cannot be deleted because by just logging into the system 1 time (Without doing anything at all) , there are many rows of data created on the workflow_action table having the tabUser listed under its link field.

This caused the system to not allow us to delete the USER account because onDeletion it will keep prompting that there is a link dependency error with the workflow action table.

Based on table name, we are also thinking it should only be triggered during workflow usage, but in actual that is not the case…the table only grows larger and larger and never reduce… eventually reaching a point where it slows down the entire system…which is why we had no choice but to comment out the code.

The funny thing is, we don’t see any consequences from doing so so far.
And cross checking the repository from latest version, we see this piece of code have not been updated at all, and wondered why no one actually noticed this problem so far.

Made a clone of our server and in the clone we truncated the workflow_action table and don’t see any major problem with it…

What is this table for anyway?

Check for error logs specific to Workflow action email. In my case the email template had invalid dynamic variables.