Visible only work in progress Tasks in Time sheet portal

NiKhil70
Kilo Guru

Hello ,

I have a requirement to show only the project tasks which are in state "work in progress" in Time sheet portal .

Present i am see all the projects tasks with different states ( work in progress , On hold , Pending , open )

Time sheet portal - > All Tasks - > Project Tasks - >  "Here i should see only the project tasks which are in state 'work in progress' ".

where do i need to make changes so that i can see only work in progress project tasks.

Thanks,

Nilesh.

1 ACCEPTED SOLUTION

1. Go to 

Service Portal Widget  -> Time Card Portal - Task Selector

 

In server script,

2. Search for defaultTables -> it has all the table listed which shows in dropdown. if you want to only show project task then remove other table names and keep only 'pm_project_task'.

3. Search for function getRecords(table) ->

it has if (gr.instanceOf('pm_project') || gr.instanceOf('pm_project_task')) { block

in this if block you can see the encoded query formation for encodedQuery.

You can add 'state=2' to encodedQuery to show only WIP project tasks.

 

Hope this will help you.

View solution in original post

9 REPLIES 9

1. Go to 

Service Portal Widget  -> Time Card Portal - Task Selector

 

In server script,

2. Search for defaultTables -> it has all the table listed which shows in dropdown. if you want to only show project task then remove other table names and keep only 'pm_project_task'.

3. Search for function getRecords(table) ->

it has if (gr.instanceOf('pm_project') || gr.instanceOf('pm_project_task')) { block

in this if block you can see the encoded query formation for encodedQuery.

You can add 'state=2' to encodedQuery to show only WIP project tasks.

 

Hope this will help you.

Please mark this answer correct, if it worked for you.

 

Thanks

Hi @Jayarnab Saha 

What if I want to make the state restriction in the drop down as well. How to do that?

Also, what precautions I need or need to share with customer for upgrades?

Hi there,

 

You can follow below article for more details.

https://community.servicenow.com/community?id=community_article&sys_id=f6a035a8db3c6c10fa192183ca961...

Customer needs to compare and resolve conflicts while upgrade to get latest changes.

Hi @Jayarnab Saha 

I am trying to follow the steps you mentioned but not ale to find the points listed.

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'); NOT FOUND
    There isn't anything like taskselector I could see either in my PDI or client instance.

    Please suggest.

  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