HRSD Approvals in service portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2024 11:14 PM
Hi All,
We have implementing HRSD for our client. Currently, We have some approval tasks associated with the HR tasks and those approvals are visible in the Employee center 'My Tasks'.
Is there any way to show these approvals in service portal as a widget. Currently , we have a widget in the service portal which will show the approvals for the logged in user, but it is not displaying the HRSD approvals.
Please let us know a solution for this if anyone encountered it before.
Regards,
Devika.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2024 01:41 AM
Yes, you can display HRSD approvals in the Service Portal. Here are the steps to do it:
1. Navigate to Service Portal > Widgets in your ServiceNow instance.
2. Click on New to create a new widget.
3. In the HTML field, you can use the 'sp-approval-list' directive to display the list of approvals. The code would look something like this:
html
My Approvals
4. In the Server Script field, you can write a script to fetch the HRSD approvals for the logged-in user. The code would look something like this:
javascript
(function() {
/* populate the 'data' object */
/* e.g., data.table = $sp.getValue('table'); */
data.approvals = [];
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('approver', gs.getUserID());
gr.addQuery('state', 'requested');
gr.query();
while(gr.next()) {
data.approvals.push({
sys_id: gr.sys_id.toString(),
document_id: gr.document_id.getDisplayValue(),
target_table: gr.target_table.getDisplayValue(),
state: gr.state.getDisplayValue()
});
}
})();
5. Save the widget and add it to the desired page in the Service Portal.
Please note that the above code is a sample and may need to be adjusted to fit your specific needs. Also, make sure that the logged-in user has the necessary roles to view the HRSD approvals.
For ServiceNow Live Classes, Books, Sample Resumes, Interview Questions, CSA Quizzes.
And getting better services's on ServiceNow you can visits our website.
Please visit : https://nowkb.com/home
Our Website :https://nowkb.com/home
nowKB.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2024 02:44 AM
Hi @Devika3
May i know why you need extra widget like approval. We already have something like this. Also we need to understand that both portals are different in design and working. So let's not compare and try to bring widegt from vice versa.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************