Newbie - Employee Service Center and Time Sheet Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 09:34 AM
Hello everyone,
I have been thrust into the ServiceNow community with very little coding experience.
My issue is that we have configured an Employee Service Center and want our employees to stay in the ESC when filling out their timesheets.
The issue I'm running into is that if they click on the previous timesheet carat button, it takes them out of the ESC and directly into the Time Card Portal (TCP).
I've been looking at the widget code for the Time Card Portal header, because that is where the action button function is located. However, I feel like this might not be the right place to stop this action.
Any thoughts or ideas on how to stay in the ESC regardless of toggling between Timesheets?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2024 09:21 AM
Hello,
I am currently facing the same request.
Did you find an answer? How did you implement it on your side?
I am considering adding a quick link or menu item to the page "worker_portal" which is the one displayed in the time card portal but I am not sure it is the right approach.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2024 10:33 AM
Hello,
I got help from Support for this and they came up with this solution. We cloned the Time Card Portal Header widget and then made these adjustments. It's been working great!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 06:14 AM
Hello again,
Thanks for sharing, it almost works.
I still have an issue where the header widget does not work at first load of the worker_portal page on employee center: I cannot go to previous timesheet, next timesheet or open the calendar to pick the related timesheet.
Although, if I go to another page of employee center and come back on timesheet page, it then works.
Did you by any chance encounter the same issue and found a workaround?
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2024 11:28 AM
Hello @jbarbieux,
Yes, we ran into similar issues. I apologize for the slow response.
It was a relatively easy fix to the code. We just removed the urlSuffix at the beginning of the new URL string. We also added some language to check that date picker exists. Here is the updated link function code that we used.
function _loadTimesheet(id){
if(id && id != scope.data.timesheetId){
//MMO Added a check that the Datepicker exists
if($("#datetimepicker_timesheet").data('DateTimePicker')){
$("#datetimepicker_timesheet").data('DateTimePicker').destroy();
}
//MMO END
var timesheetId = scope.data.timesheetId;
var userId = scope.data.userId;
var href = $window.location.href;
var newURL = '';
var regexp = new RegExp(timesheetId, 'g');
if(timesheetId && regexp.test(href)){
newURL = href.replace(timesheetId, id || timesheetId);
}else
//MMO redirect newURL
//newURL = '/tcp?sysparm_domain_restore=false&sysparm_stack=no&sysparm_timesheet_id='+ id+"&sysparm_user_id="+userId;
newURL = '?id=worker_portal&sysparm_domain_restore=false&sysparm_stack=no&sysparm_timesheet_id='+ id+"&sysparm_user_id="+userId;
//MMO END
var newTitle = document.title;
scope.data.timesheetId = id;
history.pushState({id: scope.data.timesheetId}, newTitle, newURL);
scope.data.loading = true;
}
}
function _loadUser(id){
if(id && id != scope.data.userId){
timecardPortalService.tcpImpersonation().then(function(response){
return;
});
$("#datetimepicker_timesheet").data('DateTimePicker').destroy();
var userId = scope.data.userId;
var timesheetId = scope.data.timesheetId;
var href = $window.location.href;
var newURL = '';
var regexpUser = new RegExp(userId, 'g');
var regexpTimeSheet = new RegExp(timesheetId, 'g');
if(regexpTimeSheet.test(href)){
href = href.replace("&sysparm_timesheet_id="+timesheetId, "");
}
if(userId && regexpUser.test(href)){
href = href.replace(userId, id || userId);
}else
//MMO redirect new URL
//href = '/tcp?sysparm_domain_restore=false&sysparm_stack=no&sysparm_user_id='+ id;
href = '?id=worker_portal&sysparm_domain_restore=false&sysparm_stack=no&sysparm_user_id='+ id;
//MMO END
var newTitle = document.title;
scope.data.userId = id;
history.pushState({id: scope.data.userId}, newTitle, href);
scope.data.loading = true;
}
}