- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2022 07:19 AM
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:
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2022 10:31 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2022 07:37 AM
Hello Chandler,
There are steps given on how you can achieve it exactly which line from below you were not able to understand:-
- Navigate to Service portal -> widgets from module.
- Search for record with ID : tc-grid (Time Card Grid).
- Search in Server Script -> var taskSelector = $('#task-selector');
- The select2 component is using OOB Table rest api to fetch records from task table, i.e. url: '/api/now/table/task'
- You can create your own Rest api to fetch specific records and replace the url here OR
- Extend the OOB Table rest api to query specific records. https://developer.servicenow.com/dev.do#!/reference/api/orlando/rest/c_TableAPI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2022 08:28 PM
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.
- Navigate to Service portal -> widgets from module.
- Search for record with ID : tc-grid (Time Card Grid).
- 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. - The select2 component is using OOB Table rest api to fetch records from task table, i.e. url: '/api/now/table/task'
- You can create your own Rest api to fetch specific records and replace the url here OR
- 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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2022 10:03 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2022 11:35 PM
Hello Chandler,
Did you get a chance to try it?
Hope this helps. Please mark the answer as correct/helpful based on impact.