I am trying to create a notification where if an approver user active state changes to false, it send the user details like user name and user id to a specific group for tract the approval activity/record(RITM workflow/Change request) where they are

pratikyadav
Tera Contributor

I am trying to create a notification where if an approver user active state changes to false, it send the user details like user name and user id to a specific group for tract the approval activity/record(RITM workflow/Change request) where they are mentioned and change it to the appropriate approver post confirmation from business owner of that item/services.

For this i have created an before(insert/update) Business Rule which trigger an event queue :- 

find_real_file.png 

Which triggers an event Queue,

find_real_file.png

then i have used the event under a notification.

find_real_file.png

 

Now when i am trying to change the active state of an approver user (for example a user who is part of CAB Approver, or a user who is manually added under an approver -user activity manually in a workflow). its not triggering any notification. 

 

Can you please help me to get the same achieved. Thanks

1 ACCEPTED SOLUTION

Alok Das
Tera Guru

Hi Pratik,

Thanks for the detailed requirement detail and the existing work done by you.

I see that the Business Rule which you wrote is on "sysapproval_approver" table, It should be on "sys_user" table since user active state will be updated on "sys_user" table. Please change the script accordingly.

Also, I see that as per your script the email will be triggered for each request, I believe that would not be a great user experience, if numbers of approval is pending from approver and approver profile is deactivated it will trigger number of emails (For example: If there are 100 requests pending from approver and approver is set to active false so 100 separate emails will be triggered or The users in bulk are deactivated it would send huge number of emails).

What I suggest is to Create a Scheduled Report instead and Send it at once, It will send a single email with the attached list of all the deactivated users with pending request.

Please find the sample attached:

  1. Create a Report

find_real_file.png

    2. Create a Scheduled Report

find_real_file.png

 

Please mark my answer as correct/helpful based on impact.

Regards,

Alok

View solution in original post

3 REPLIES 3

harishdasari
Tera Guru

Hi Pratik,

In Notification,  make sure check the send to event creator and event parm1 checkboxes are checked.

 

find_real_file.png

 

Hope this is Helpful.

Thanks.

Harish KM
Kilo Patron
Kilo Patron

Hi your BR should be on user table

before update

condition Active changes to false

script:

var user = current.sys_id;
var app = new GlideRecord('sysapproval_approver');
app.addQuery('app.approver',user);
app.query();
if(app.next())
{
gs.log("user inactivr]e");
gs.eventQueue('approval.rejected',current,gs.getUserID(),gs.getUserName()); //your event
}

Regards
Harish

Alok Das
Tera Guru

Hi Pratik,

Thanks for the detailed requirement detail and the existing work done by you.

I see that the Business Rule which you wrote is on "sysapproval_approver" table, It should be on "sys_user" table since user active state will be updated on "sys_user" table. Please change the script accordingly.

Also, I see that as per your script the email will be triggered for each request, I believe that would not be a great user experience, if numbers of approval is pending from approver and approver profile is deactivated it will trigger number of emails (For example: If there are 100 requests pending from approver and approver is set to active false so 100 separate emails will be triggered or The users in bulk are deactivated it would send huge number of emails).

What I suggest is to Create a Scheduled Report instead and Send it at once, It will send a single email with the attached list of all the deactivated users with pending request.

Please find the sample attached:

  1. Create a Report

find_real_file.png

    2. Create a Scheduled Report

find_real_file.png

 

Please mark my answer as correct/helpful based on impact.

Regards,

Alok