How to remove spa=1 from the URL in service portal ?

Varshini
Kilo Expert

Hi,

Unable to reload catalog URL page spa=1 is stopping to reload/refresh the page.

URL is appened with spa=1 all the time when the category is clicked on the left side. Also verified SC Category widget is not customatized using OOB widgets.

Can somebody help me to fix this ?

Need to remove spa=1 from URL each time when category is clicked.

 

 

id=sc_category&sys_id=e15706fc0a0a0aa7007fc21e1ab70c2f&catalog_id=-1&spa=1

 

10 REPLIES 10

Ct111
Tera Sage

Hello you can do something like this

var url = 'id=sc_category&sys_id=e15706fc0a0a0aa7007fc21e1ab70c2f&catalog_id=-1&spa=1'

var str= url.replace('&spa=1','');

gs.addInfoMessage(str);   

Output : 'id=sc_category&sys_id=e15706fc0a0a0aa7007fc21e1ab70c2f&catalog_id=-1'

if it being put in client script then use

spUtil.addInfoMessage rather than gs.addInfoMessage.


Mark my ANSWER as CORRECT and HELPFUL if it helps

  1. Varshini if you need any more help let me know.

Else can you Mark my ANSWER as CORRECT 

so that anyone in future with similar query will benefit from it

NJensen
Tera Contributor

Hello Varshini,

This is occuring in our Dev environment as well after upgrading to Rome Patch 1 (upgraded to Patch 2 this week and behavior still occurs).

I was looking through the client controller on that SC Category widget and it appears a new 'sp' parameter is being injected into the URL here.  Unfortunately this is read only so I'm not sure how to fix this either.

image

AnirudhKumar
Mega Sage
Mega Sage

I guess your query is already solved, but consider this another solution that I just found.

1. Add a new widget on your esc_sc_category page

2. The purpose of this widget is just to remove the spa=1 from the url.

3. In the client controller field, keep only the below lines of code:

api.controller = function($scope, $location) {
    /* widget controller */
    var c = this;


    $scope.$on('$locationChangeSuccess', function() {


        var locObj = $location.search();

        if (locObj.spa) {

            $location.search({
                id: locObj.id,
                sys_id: locObj.sys_id,
                catalog_id: locObj.catalog_id
            });

        }
    });
};