- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-08-2019 01:23 AM
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 :-
Which triggers an event Queue,
then i have used the event under a notification.
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
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-08-2019 09:00 AM
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:
- Create a Report
2. Create a Scheduled Report
Please mark my answer as correct/helpful based on impact.
Regards,
Alok
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-08-2019 01:55 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-08-2019 02:01 AM
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
}
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-08-2019 09:00 AM
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:
- Create a Report
2. Create a Scheduled Report
Please mark my answer as correct/helpful based on impact.
Regards,
Alok