Send custom approval notification from workflow instead of OOB notification

Aaron Munoz
Tera Guru

I have a table that extends task, with a workflow that triggers approval requests. I want to send a custom email notification for the approver. The one I created is triggered from the same event (approval.inserted) as the OOB notification for approval requests, but now both are getting sent. The OOB notification doesn't have a weight, so I can't use that to avoid sending it.

The only way I got it working is by applying a filter condition on the OOB notification, but this is not ideal. The other solution I can think of is using a "Run Script" activity that creates the approvals but fires a custom event, though this may be difficult to reverse-engineer from the "Approval - User" activity. Is this the best approach, or is there a better way to avoid changing the Out Of Box notification?

1 ACCEPTED SOLUTION

Aaron Munoz
Tera Guru

For future reference, here is what's needed to fulfill this requirement:

  1. Create a new event in the event registry, like u_custom_task.approval.inserted
  2. Create a new notification that is triggered when the your event is fired
  3. Modify the OOB business rule called "Approval Events (Task)" and in line 40 add two lines of code like the following
       else if (current.sysapproval.sys_class_name == "u_custom_task")
       event = "u_custom_task.approval.inserted";

The steps above should be enough to add only one custom approval notification. You may want to make this extensible by creating a table that matches your custom events with your custom tables, and in the business rule calling a script include that queries that table.

View solution in original post

11 REPLIES 11

osni seca
Kilo Expert

Correction: u_second_task.approval.inserted

SB88
Tera Contributor

I tried this and now it is sending 2 notifications. The OOB and the custom one I created. 

I think im getting stuck on "else if (current.sysapproval.sys_class_name == "u_custom_task")"  What am i to enter for "u_custom_task"?  Am i suppost to create a custom task on the task table for a catalog item i created?