Service Portal Simple List View All

gaf627
Tera Expert

I'm using a simple list widget to display the logged in user's open requests (these are actually record produced tasks).   The list displays perfectly and I've set the limit to 10.   After 10, it displays View All.   When I click View All, it displays a different list with columns that we don't want displayed.   Any idea, how to edit the list of columns?   I've tried changing the view on the widget instance to default view and self service to match the backend views, but this does not make a difference.   Any help would be appreciated. Thanks!

1 ACCEPTED SOLUTION

LaurentChicoine
Tera Guru

Hi Greg,



I took a quick look at the list page with the "Data Table from URL Definition" widget. I was unable to find where the default columns are defined.



However, you can specify a specific view to use when using the "Data Table from URL Definition" widget. From there, you have two options (both requires cloning and modifying an OOTB widget).



1. Update the "Data Table from URL Definition" widget to use a default view of your choosing. In the server script, replace the following line:



data.view = $sp.getParameter('view');



with



data.view = $sp.getParameter('view') || 'default';



I did put default (which will use the default view in the system) but you could use "ess" or something else. That way if no view is specified as a parameter, this view will be used instead of the view that I can't find where it is defined.



Then, update the list page with the page editor to replace the OOTB widget with the new cloned widget.



2. Update the "Simple List" widget to pass a default view when pressing on "View All". In the client script, add the view parameter to the see all function:



      this.seeAll = function(){


              $location.search({


                      id: c.options.list_page_dv || 'list',


                      table: c.options.table,


                      filter: c.options.filter,


                      view:   c.options.u_view || 'default' //Setup an option for your custom Simple list if you want to be able to specify the view in the widget instance


              });


      };



Then, update your page that are using the Simple List with the page designer to replace the OOTB widget with the new cloned widget.




Personally, I have a preference for the second option which would allow you to setup a new option that will chose the selected view for each widget instance. To do so, simply create a new field with the column name "u_view" on the "sp_instance_vlist" table.


View solution in original post

17 REPLIES 17

This saved my day. Thank you so much.


First of all Thanks,

It worked. I duplicated portal page called 'list', and duplicated the Widget "Data Table from URL Definition", and modify the line "data.view = $sp.getParameter('view');", and I wroted my own view.

 

I did not need the second step.

 

Thanks for all!!

marcoamoruso
ServiceNow Employee
ServiceNow Employee

Hello Greg,



Another way to change the list layout for Service Portal would be to change the Mobile view through 'System UI -> Views':


- Name: Mobile


- Open the view and select the tab Lists


- Open the list to the related table, e.g. incident


- Change the List elements to reflect the desired layout, e.g. I have added the field Active:


Screen Shot 2017-07-05 at 12.26.16 PM.png


- Open the list of records for the desired table:


Screen Shot 2017-07-05 at 12.26.25 PM.png



In this way, you don't have to clone the original widget and make changes to it.



Best regards,


Marco


Thanks Marco!



This is amazing. At first I was like...Mobile View? How would that help me, but I'm guessing the default view for this is Mobile?



Either way...as long as you know the element names or know how to look them up (one way is to go to your incident and right click on the name of the field you want to know the element name of and choose: Configure Label) you'll be all set.



Thanks again for this!



Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

This is great info.

Do you know how to sort this list? OOB it sorts the number field ascending. We would like to change it to descending.