How to set the count number of approvals and surveys in My active items widget?

Ruben Gustavo E
Tera Contributor

find_real_file.png

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.
find_real_file.png

Which script should I use to achieve this?
Im in Rome version.
Thanks in advanced.

5 REPLIES 5

Community Alums
Not applicable

Hi @Ruben Gustavo Escamilla ,

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.

In the My active items widget, the Tasks and Requests activities are available by default in the Employee Center. The Tasks activity is set to primary by default. The Task activities are displayed using the existing to-do configuration and the Requests activities are displayed using the existing request filters.

Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

Craig Steel - F
Tera Guru

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.

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'
});

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();