Next and Previous Record on Service Portal Form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2020 09:19 AM
Looking to add functionality to the service portal form widget to go to the next and previous record in list like we have in the platform. Any ideas on this? Would we need to create a new widget or modify the form widget?
See screenshot from platform view below. Thanks for the help
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2020 01:30 PM
Hmm. That's a pretty cool idea actually. It would not be necessary to modify the form widget, but how you approach this will depend on where you want to physically place it on the page.
I wrote a community article thing on injecting an object like this into a widget using JQuery that describes how you could place that button in the form.
There will be some tricky work here to determine the navigation part. Basically you'll need some server side code to determine the 'next' sys_id in the table view the user is coming from. Once you have that you can use $location to navigate to the next (or previous) record by URL.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2020 01:53 PM
As of my knowledge, the service portal form widget is OOB, it won't let you edit the widget you need to clone and modify.
I recommend creating an independent widget and place that on-page.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2020 10:16 AM
Hello,
As per my knowledge, you can implement the functionality only when you open a record from list view. Once you right click on the form header and select Copy URL and paste the URL in different window, the same record form opened will not have the arrows. I think the previous and next record marks will show up only when you open a record from a list in application view. The same can be achieved if you try to open a record from list widget in portal. There are many challenges you can face here as you implement the solution in service portal. Different users will have access to different number of records. For example an user A will have access to some number of incidents where as user B can not have access to same number of records. In this case the previous and next incident records will definitely change for the users A and B from the same incident record which they have opened in platform view. It could be because of ACLs or Query Business rules.
But if you are trying to implement the same functionality, I would suggest to implement the same way as in normal application view. From the list widget, you can possibly get list of incident sys_id's and push them in an array and using broadcast event in portal you can send the data to the form widget once user clicks on any record in the list. If you can find a way to arrange the incidents records or any other table records in sequential manner in the array and pass it on to the form widget and there you can get the index of the current record and can get previous and next records using the index-1 and index+1.
Thanks,
Jagadeesh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2020 12:13 PM
Hi,
Thanks for asking this interesting question. I have created a share for this problem statement along with installation guide. Also, the share doesn't need you to modify any out of the box. Details are as follow
Share link https://developer.servicenow.com/connect.do#!/share/contents/3490912_service_portal_next_and_previous_feature_on_form?v=1.0&t=PRODUCT_DETAILS
In action
Please mark answer correct if this helps you.