Time sheet portal changes for "Add Unassigned Task".

Chandler2
Tera Guru

On time sheet portal we have a link "Add Unassigned Task" using which a user can select any task by searching it. I want to restrict this search so users can only select a particular type of task, for example only incidents or demands which are work in progress.

I found an article for the same and tried to follow the steps but can't find the names mentioned in the post. Below is the link of the post: https://community.servicenow.com/community?id=community_article&sys_id=f6a035a8db3c6c10fa192183ca961...

Below is the portal view: 

find_real_file.png  

1 ACCEPTED SOLUTION

Hello Chandler,

 

Go the Time Card Grid widget.

In that widget go to link function. In the link function you would see an AJAX call to /api/now/table/task.

There would be a sysparm_query to the AJAX call, change the parameter like this

sysparm_query: 'sys_class_name=pm_project^ORsys_class_name=pm_project_task^short_descriptionCONTAINS' + term + '^ORnumberCONTAINS'+ term,

 

This will restrict to project/project tasks alone.

 

Hope this helps. Please mark the answer as correct/helpful based on impact.

View solution in original post

9 REPLIES 9

Saurav11
Kilo Patron
Kilo Patron

Hello Chandler,

There are steps given on how you can achieve it exactly which line from below you were not able to understand:-

  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_TableAPI

 

Hope this helps. Please mark the answer as correct/helpful based on impact.

 

Hi Saurav

The steps you mentioned are from the same post which I have mentioned in my question with the link. The steps are not working for me due to below:

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.
  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

 

Can you help with something else or show me where exactly these values are as I couldn't find any such in the server script.

Hello Chandler,

There is a Widget called Time Card Portal - Task Selector where in the Server Script the default tables are defined so, if you want to add/remove any task table from there will do the trick i believe.

find_real_file.png

Hello Chandler,

Did you get a chance to try it?