- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2023 10:26 AM
Hi All,
We have HR Tasks, Approvals, etc that show for the user in the To-Dos widget and page. In the My Active Items widget, the tasks activity is referencing the To-Dos page and the approvals activity is referencing the Approvals page. The issue is that the number of approvals are showing in the tasks AND approvals. Is there a way to only show the number of HR Tasks only (and not include Approvals) in the Tasks Activity in the My Active Items widget?
Thanks!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2023 09:29 PM
Yes, you can customize the My Active Items widget to display only HR Tasks and exclude Approvals in the Tasks Activity. To do this, you need to modify the data source used by the widget. Follow these steps:
- In ServiceNow, navigate to Employee Center Configuration > Data Sources.
- Locate the data source used by the Tasks Activity in the My Active Items widget. It might be named something like "My HR Tasks" or "My To-Dos".
- Click on the data source record to open it.
- In the "Script" field, you'll find the script that fetches the tasks for the user. You need to update the script to filter out Approval tasks.
- Modify the script to add an additional filter condition in the GlideRecord query for the HR Task table. The additional condition should exclude HR Tasks that have a "Task type" of "Approval" or any other criteria that can uniquely identify Approval tasks. For example:
var hrTaskGr = new GlideRecord('sn_hr_core_task');
hrTaskGr.addQuery('assigned_to', gs.getUserID());
hrTaskGr.addQuery('state', 'IN', '1,2'); // Open or Work in Progress states
hrTaskGr.addQuery('task_type', '!=', 'Approval'); // Add this line to exclude Approval tasks
hrTaskGr.query();
- Save the data source record.
After making this change, the My Active Items widget will display the number of HR Tasks without including Approvals in the Tasks Activity count.
Note: Test your customizations in a non-production environment before implementing them in your production instance. Make sure to adapt the script to your specific HR Task table structure and field names if they differ from the example provided.
---------------
Regards,
Rajesh Singh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2023 09:29 PM
Yes, you can customize the My Active Items widget to display only HR Tasks and exclude Approvals in the Tasks Activity. To do this, you need to modify the data source used by the widget. Follow these steps:
- In ServiceNow, navigate to Employee Center Configuration > Data Sources.
- Locate the data source used by the Tasks Activity in the My Active Items widget. It might be named something like "My HR Tasks" or "My To-Dos".
- Click on the data source record to open it.
- In the "Script" field, you'll find the script that fetches the tasks for the user. You need to update the script to filter out Approval tasks.
- Modify the script to add an additional filter condition in the GlideRecord query for the HR Task table. The additional condition should exclude HR Tasks that have a "Task type" of "Approval" or any other criteria that can uniquely identify Approval tasks. For example:
var hrTaskGr = new GlideRecord('sn_hr_core_task');
hrTaskGr.addQuery('assigned_to', gs.getUserID());
hrTaskGr.addQuery('state', 'IN', '1,2'); // Open or Work in Progress states
hrTaskGr.addQuery('task_type', '!=', 'Approval'); // Add this line to exclude Approval tasks
hrTaskGr.query();
- Save the data source record.
After making this change, the My Active Items widget will display the number of HR Tasks without including Approvals in the Tasks Activity count.
Note: Test your customizations in a non-production environment before implementing them in your production instance. Make sure to adapt the script to your specific HR Task table structure and field names if they differ from the example provided.
---------------
Regards,
Rajesh Singh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2023 11:19 AM
Hello,
I am unsure of where Employee Center Config-->Data Sources is. The product doc directs me to Employee Center-->Activity Configuration. Once there, I am unsure how to filter to only HR Tasks.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2024 07:53 AM
Unable to navigate to Employee Center Configuration > Data Sources.. Could you please provide detailed steps for this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2024 08:12 AM
Agree - Unable to navigate to Employee Center Configuration > Data Sources.
Can you elaborate on how to exclude approvals from the tasks list? I added approvals as an activity configuration item so I don't want it duplicated under tasks....