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

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,



You need to change at two places

1)find_real_file.png

 

2) find_real_file.png

 

Thanks,
Ashutosh

Hi Ashutosh ,

Thanks for the quick response .

I have commented the unwanted tables names in Server Script in "Time card portal - Task Selector".

when  i click on "Generate Time Cards" , now i don't see other categories . ( working as expected  )

But still i am able to add the unwanted categories by clicking on "Add unassigned tasks to timesheet" , please find the below screen shot highlighted in yellow where it allowed me to add Stories & Project

How to restrict this option ?

find_real_file.png

 

Thanks 

NR

HI,

You have to do adjustment in add-task-modal angularTemplate.


Thanks,
Ashutosh

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