Catalog Item redirection in the NowMobile app

Patrick Quinlan
Giga Guru

We are getting ready to roll out NowMobile in our environment and have come across an issue that we are trying to address. We have a few Catalog Items that, depending on the answer to a variable, it redirects you to another request. The biggest of these requests is called 'Software Request'. We provide the user with a number of different options in a single request. One of the choices is 'Software Installation' which provides them with a variable of a list of all Software catalog items. When they pick one, it redirects them to the appropriate request. 

In our Service Portal, this redirection works perfection. In the Now Mobile app, the redirection actually opens our SP inside the app. We would like for it to simply redirect them to the Mobile view of the catalog item. 

The Catalog Client script that provides the redirection is as follows:

top.window.location.href = 'sp?id=sc_cat_item&sys_id=' + ref.sys_id; 

ref.sys_id in this line of code references the sys_id from the variable of the software selection. 

Does anyone know how I can modify this so that it will tell the app to simply open the catalog item in the app as opposed to displaying the portal inside the app?

1 ACCEPTED SOLUTION

Patrick Quinlan
Giga Guru

I was able to find the answer that I needed. Just in case anyone else runs across this issue: 

 

The NowMobile app uses the 'Mobile Employee Service Portal' which has the URL prefix 'mesp'. 

In order to solve my issue, I had to identify which method the user was viewing the catalog item. I did this by including the following code in my onChange client script:

var url = top.window.location.href; //identifies the URL that is displaying the catalog item
if(url.indexOf('/sp') != -1{ 
  top.window.location.href = 'sp?id=sc_cat_item&sys_id=' + ref.sys_id;
}else{
  top.window.location.href = 'mesp?id=sc_cat_item&sys_id=' + ref.sys_id;
}

//IF the user is viewing in the regular browser service portal, the value of url.indexOf('/sp') will not be -1 and the next line of code will use sp? in the location.href to redirect them to the Service Portal view. 

//IF the user is viewing on NowMobile, the value of url.indexOf('/sp') WILL BE -1 and it redirects them to the mobile version of the item. 

 

Hope this helps. 

 

View solution in original post

2 REPLIES 2

Patrick Quinlan
Giga Guru

I was able to find the answer that I needed. Just in case anyone else runs across this issue: 

 

The NowMobile app uses the 'Mobile Employee Service Portal' which has the URL prefix 'mesp'. 

In order to solve my issue, I had to identify which method the user was viewing the catalog item. I did this by including the following code in my onChange client script:

var url = top.window.location.href; //identifies the URL that is displaying the catalog item
if(url.indexOf('/sp') != -1{ 
  top.window.location.href = 'sp?id=sc_cat_item&sys_id=' + ref.sys_id;
}else{
  top.window.location.href = 'mesp?id=sc_cat_item&sys_id=' + ref.sys_id;
}

//IF the user is viewing in the regular browser service portal, the value of url.indexOf('/sp') will not be -1 and the next line of code will use sp? in the location.href to redirect them to the Service Portal view. 

//IF the user is viewing on NowMobile, the value of url.indexOf('/sp') WILL BE -1 and it redirects them to the mobile version of the item. 

 

Hope this helps. 

 

Thanks for sharing your resolution with us Patrick!


Best,

David