Custom Event Not Triggering Notification for HR Talent Management Approval (sysapproval_approver)

Ramsha Shaikh
Tera Contributor

 

Hi everyone,

I'm working on a requirement to send a different approval notification for HR Talent Management Cases based on the assignment group.

Current Setup

  • Table: sysapproval_approver
  • The OOTB approval notification listens for the approval.inserted event.
  • I have modified the notification so that it does not send for two specific assignment groups by using an Advanced Condition:

 

 
var rec = current.sysapproval.getRefRecord();

if (rec.isValidRecord() &&
    rec.getTableName() == 'sn_hr_core_case_talent_management') {

    var groupId = rec.getValue('assignment_group');

    if (groupId == '18266f75c3f103547cce581f050131d1' ||
        groupId == '27466ff9c3f103547cce581f05013115') {

        return false;
    }
}

return true;
 
 

This works as expected.

New Requirement

For those two assignment groups, I need to send a different approval notification.

To avoid modifying the existing notification, I created:

  • A new event: approval.inserted.hr.record
  • A new notification that listens to this event.

I also created a Business Rule on sysapproval_approver to queue the new event when:

  • The approval record is inserted
  • The approval is for sn_hr_core_case_talent_management

However, the new notification is never sent.

Any guidance or best practices would be appreciated.

Thanks!

1 REPLY 1

RaghavendraGund
Tera Contributor

Hello @Ramsha Shaikh 

If I understand the requirement right,

The OOB approval Notification currently goes to the approver  for all approvals, Including Talent Management cases, irrespective of assignment group. 
You want approvals on Talent Management cases belonging to 2 specific assignment groups to get a different notification instead. So, for these 2 assignment groups, the OOB Notification stops , only the new goes.
is that correct?

If so, you do not need the custom event or the business rule, Both Notifications can use the same approval.inserted event with conditions that are the opposite of each other.

your existing notification already has the exclusion. on the new one, use this in the Advanced condition on the When to send Tab:

var rec = current.sysapproval.getRefRecord();

if (rec.isValidRecord() &&
rec.getTableName() == 'sn_hr_core_case_talent_management') {

var groupId = rec.getValue('assignment_group');

if (groupId == '18266f75c3f103547cce581f050131d1' ||
groupId == '27466ff9c3f103547cce581f05013115') {
return true;
}
}

return false;

Two differences from yours: the inner branch returns true instead of false, and it ends with return false so this notification stays quiet for every other approval on the instance. Yours has to end with return true because the OOB one still needs to work for everything else.

The rest of the new notification should match the existing one — Table sysapproval_approver, and Users/groups in fields set to Approver under Who will receive. Only the subject and body change. Once that is in place you can remove the custom event and the business rule.

Please Mark "Helpful" if my Reply added any Value

Regards
Raghavendra G