- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2020 07:10 AM
I am new to working with the Widget portion of ServiceNow. We have a requirement to mimic the current My Request functionality on the portal page to specifically search requests and/or incidents that have the term 'transHUB' in the short description. I have created a new catalog request item called 'transHUB requests' for many different request items the end user may need (new maintain item and workflow that is all working). This is an important initiative and expect a good number of requests with this category/topic. I have cloned the 'My Requests' widget (my-requests-v2) and cloned the My Requests page. Both called transhub_requests. I have also added a new menu to the SP Header Menu to have 'transHUB requests' appear in the banner next to 'Tickets'(see below). I have also created a new 'my request filter', as shown below, to reference this widget and page. I can get the page to appear when I click on the 'transHUB requests' from the menu selection and displays my page. It appears to be pulling the same logic as in My Requests but I assume that I need to update a script some place but sure where. But I cannot, and do not honestly know where, to set the query so that it returns only requests and/or incidents with 'transhub' contained in the short description field. Any direction or assistance here would be appreciated. Or if there is a better solution out there. I first tried a Simple List but the user wants to be able to search on these selected incidents/requests so the simple list was not an option, unless I am missing something.
HHere is my new My Request Filter:
Thank you and any assistance would be greatly appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2020 12:02 PM
Thanks Colleen.
Please mark my answer correct if it is the correct solution.
Happy to help !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2020 07:56 PM
Gopi,
Thanks for the input but I am not familiar with modifying the server script. Is it something I need to change in this part of the server script? I haven't changed it yet from the My Requests widget. Again, I am not familiar with this functionality.
Thank you and any guidance would be greatly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2020 07:17 AM
HI Colleen,
Please find below section in the server script where we are querying from sc_request table:
var gr = new GlideRecordSecure('sc_request'); // does ACL checking for us
gr.addActiveQuery();
options.title = options.title || gr.getPlural();
data.display_field = 'sys_created_on';
data.secondary_fields = ['number','sys_updated_on'];
data.filterMsg = gs.getMessage("Filter...");
gr.addEncodedQuery('requested_for=javascript:gs.getUserID()');
gr.orderByDesc('sys_created_on');
gr.query();
You might need to add an extra query like below:
gr.addEncodedQuery('short_descriptionLIKEtest'); // I have filtered with Short Description contains "test"
Please let me know if you still have any questions on this.
Thanks,
Gopi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2020 09:53 AM
Gopi,
Thank you. I will have to try this but this is in the My Requests widget. I am confused and not sure why there are two "My Requests" widgets and does one call the other one? If so, what is the order? I cloned the one below in yellow but the code you pointed out is in the other "My Requests" widget. Do I need to clone both?
The overarching issue is that the logic is pulling in all the filters in the "My Requests Filter" setup/page. I guess that is expected but I just need a page, similar to this page that only shows requests for "transHUB request" and any incidents with "transhub" in the short description. Do I need a new widget or is there a better one to model after?? I feel like this is close but not sure... do I clone the non-my-requests-v2 widget and if so, what calls it? Any further guidance would be greatly appreciated. thanks (I will try your filter now but not sure where to put it in the cloned 'my-requests-v2' server script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2020 12:11 PM
Gopi,
Thank you for your input. I took your advice and added your logic, slightly modified, and here is what I changed on my transhub_request widget to adjust the queries - it is getting closer but the links do not work for sc_req_item. I just wish the filter could dot walk from sc_request to sc_req_item. (see attached for screenshots)
If you hover over the first two items, you get the following urls. The second one works but not the first one. if the first one could stay as 'sc_request', I think this would work?
Item #1 points to this url which doesn’t work since it is pulling the sc_req_item and not the sc_request. Cannot pull the correct request since the short description value is on the item level. : https://<instance>.service-now.com/sp?id=transhub_requests&table=sc_req_item&sys_id=e43549d61bc70010e84b3333cc4bcb49
Item #2 points to this url which works since it is an incident: https://<instance>.service-now.com/sp? id=ticket&table=incident&sys_id=3186aa1b1b0bc410c0312fc4bd4bcb3b
On the flip side, when I select "Tickets" or "Requests" in the header, it is picking up the new filter as well. ugh.
Thoughts?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2020 02:55 PM
Hi Colleen,
Do you want to get into a screen sharing call and explain me ?
Thanks,
Gopi