Restrict Categories in Timesheet portal from "Generate Time Cards" option

NiKhil70
Kilo Guru

Hi ,

I have a requirement to hide all the categories  Except "Project task" under Tasks - > All Tasks in Time Sheet Portal.

It got fixed my making the changes to the Server Script in 'Time Card Portal Main Container' widget , please find the 2 nd screenshot attached.In line 33 , i have commented all the table names .In line 36 i have put only  pm_project_task table.

I don't see other tasks -> under Tasks - > All Tasks

But when i click on "Generate Time Cards" , i see all the categories are again visible under Tasks - > All Tasks.

My Requirement is to completely restrict the below categories except "Project task" .

1. Incidents
2. problems
3. Change requests
4. Stories
5. Scrum tasks
6. Test plans
7. Project task
8. Projects
9. Defects
10. Enhancements
11. sn_customerservice_case
12. wm_order
13. wm_task

How can i restrict the categories from "Generate Time Cards"  ?

find_real_file.png

find_real_file.png

Thanks 

NR

1 ACCEPTED SOLUTION

Jayarnab Saha
ServiceNow Employee
ServiceNow Employee

Hi NR,

 

"Add unassigned tasks to timesheet" has a select2 dropdown, which query to task table with ServiceNow standard table query api. Incident, Case, Project, Demand and many more tables are extended from task table, so you are able to see all type of tasks in this dropdown.

To restrict this, you need to

1. navigate Service portal -> Widget -> tc-grid (Time Card Grid).

2. Open 'link function'.

3. Search for '/api/now/table/task'.

4. Instead of 'task', you need to replace with 'pm_project_task'.

 

This will only get records from Project Task table. 

 

Hope this will help you with your requirement.

 

Thank you,

Jayarnab

View solution in original post

11 REPLIES 11

Hi Jayarnab ,

Thanks for your help .

I am made the changes as per your steps mentioned above .

working as expected .

Thanks ,

NR.

Hi Jayarnab ,

while testing i am seeing  ( Defects & project tasks ) when i click on "Generate Time cards".

Our requirement is see only "Project Tasks" , let me know if any thing more needs to be changed.

Thanks,

NR

 

Hi NR,

I think Generate Time Cards, directly create time cards from backend. there is no option to select what type of time cards.

Where exactly are you seeing Defects?

 

As per previous workaround, that will work for "Add unassigned tasks to timesheet" and  '/api/now/table/pm_project_task' will only return records from Project Tasks.

Please check once.

Hi Jayarnab ,

Issue related to "Add unassigned tasks to timesheet" is solved .

But when i click on "Generate time cards" , i see Defects are showing for entering the hours.

find_real_file.png

 

Thanks

NR.

Hi NR,

 

Generate Time Cards, creates time cards for existing tasks from the same time sheet. You may have Defects as part of the timesheet (check in time_sheet.list), for which that us getting created in current timesheet.

For more insights, you can check TimeCardGenerator (script include) -> 'generate' function. This function get triggers on generate time cards.

Either you have to remove Defects from existing time sheet (this is more recommendable, if you don't want defects in any of your timesheet) or you need to understand and update this 'generate' function.