logo

NJP

Exclude/Include any Tasks type from Time Sheet Portal

Import · Nov 27, 2020 · article

OOB Time Sheet Portal shows all the task records present in tasks table. If we want to modify the OOB behaviour to show desired task type, we need to update in two widgets.

Task pane

image

If you wish to add more tables or remove OOB task types to show in Task tab (in left pane), then follow below steps:

  1. Navigate to Service portal -> widgets from module.
  2. Search for record with ID : timecard-portal-container (Time Card Portal Main Container).
  3. Search in Server Script -> data.taskSelector = $sp.getWidget('timecard-task-selector'
  4. You can see a list of tables mentioned there. You can modify the list to show expected tasks ( OOB there is no widget input present, but if you have already some inputs, then this modification of tasks will get skipped).

Task selector

image

If you wish to add/remove specific task types from the task selector dropdown, i.e. Add unassigned tasks to Time Sheet, follow below steps.

  1. Navigate to Service portal -> widgets from module.
  2. Search for record with ID : tc-grid (Time Card Grid).
  3. Search in Server Script -> var taskSelector = $('#task-selector');
  4. The select2 component is using OOB Table rest api to fetch records from task table, i.e. url: '/api/now/table/task'
  5. You can create your own Rest api to fetch specific records and replace the url here OR
  6. Extend the OOB Table rest api to query specific records. https://developer.servicenow.com/dev.do#!/reference/api/orlando/rest/c%5FTableAPI

N.B.:

  • This is completely a customisation, so while upgrading instance version it needs special attention to get updated version along with this customisation.
  • Adding many task types, may cause performance degradation of Time Sheet Portal. Querying to a huge number of records, will delay the page load/operations.
View original source

https://www.servicenow.com/community/spm-articles/exclude-include-any-tasks-type-from-time-sheet-portal/ta-p/2299697