How to set the count number of approvals and surveys in My active items widget?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2022 10:30 AM
I would like to see the number of Approvals and Surveys the user has assigned to him. I'm a novice on employee center, as I understand I have to use a script include under the Summary view script in order to achieve it.
This is how I set it for Approvals.
Which script should I use to achieve this?
Im in Rome version.
Thanks in advanced.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2022 05:56 AM
Hi
You should be able to see the number of Approvals and Surveys the user has assigned to him automatically OOTB, no need to set it additionally.
For testing, you can cerate a survey or approval assigned it to yourself, you should see it in Employee center under this Widget.
The My active items widget displays all user activity that requires your input or review.
Mark my answer correct & Helpful, if Applicable.
Thanks,
Sandeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2023 10:39 AM
Ruben:
If this is still an issue for you, you were definitely on the right track regarding needing a new function in your script include to count Approvals.
I had the same issue and this is the function I added into the ActivityConfigurationUtil script include to accomplish the feat.
-------------
getApprovalCount: function() {
var gr = new GlideRecord('sysapproval_approver');
gr.addEncodedQuery('state=requested^approverDYNAMIC90d1921e5f510100a9ad2572f2b477fe');
gr.query();
var taskCount = 0;
while(gr.next()){
taskCount = taskCount + 1;
}
return taskCount;
},
----------------
to take it a step further, if you want to remove the approvals from being listed in the "Tasks" count as well, you can turn off the Approvals (tab=Open) under To-dos Configuration. This then shows just the approvals under your new Approval Activity Config and keeps the Tasks one for, you know, actual tasks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2023 10:59 AM
Hey Craig, thanks for the great tip. Curious if your ActivityConfigurationUtil script include needed any other changes? Tried the function but it doesn't seem to be updating the "Approvals" count on the homepage "My Active Items" widget.
Here's what it looks like...
var ActivityConfigurationUtil = Class.create();
ActivityConfigurationUtil.prototype = Object.extendsObject(ActivityConfigurationUtilSNC, {
getApprovalCount: function() {
var gr = new GlideRecord('sysapproval_approver');
gr.addEncodedQuery('state=requested^approverDYNAMIC90d1921e5f510100a9ad2572f2b477fe');
gr.query();
var taskCount = 0;
while(gr.next()){
taskCount = taskCount + 1;
}
return taskCount;
},
type: 'ActivityConfigurationUtil'
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2023 01:15 PM
Zach:
You also need to call the new Script Include function from the appropriate Activity Configuration as well. In our case, we went with a new Activity Config called "Other Approvals" (for client reasons, don't ask) and included this line as the Summary View script:
new sn_ex_sp.ActivityConfigurationUtil().getApprovalCount();