How to pass data from one Service Portal page to another?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2019 11:50 AM
Hi,
I'm currently setting up a Service Portal, and I would like to be able to pass some data from page to page. On the Homepage I have a drop-down where the user can pick a project they are on and product that they own, and then they click a button that takes them to another page to choose a Catalog Item. I would like to pass the Project and Product selections over to the next page so that I can use it to filter down the Catalog Items that the user sees. I believe I can pass those values within the page URL but I'm not familiar with how to do that. Any suggestions would be appreciated.
- Labels:
-
Customer Service Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2019 03:53 PM
you may use Angular rootScope to pass data as an option
however there is data object that is being passed from server to client: Widget scripting
may be used in your case as well ..
For Example:
Server script should write something like
data.user_id = gs.getUserID();
Client script of widget will ready this info:
$scope.data.user_id;
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2019 07:57 PM
When you click the button fire an event like this in you client scriot:
function ($scope, $window) {
var c = this:
c.onClick = function () {
$window.location.href = "/sp?id=new_widget&variable=" + variable;
}
}
this redirects you to new_widget page with the parameter variable.
On the server-side script of the catalog item, you can get the parameter like:
var variable = $sp.getParameter('variable');
Best regards,
Chiristian

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2019 11:58 PM
Hi
You can use $location.search(); by defining the $location in the client script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2019 12:47 AM
Hi Candon,
This is what you need to do.
- First you need to hook into the page navigation event to append your parameters in the url.
- Read those new parameters on the Catalog Item widget’s server script ( or client script),
- Use it to filter your items.
#1. On homepage, put this code in the Drop-down widget's Client Script. (Dont forget to add '$window' up there as dependency, shown below). Make sure you pass the projectValue and productValue in below code.
var deregisterListener = $rootScope.$on('$locationChangeStart', function (event, next, current) {
event.preventDefault();
var q = '&project=' + encodeURI(projectValue) + '&product=' + encodeURI(productValue);
$window.location.href = next + q;
deregisterListener();
});
function($window) {
var c = this;
.
.
.
#2. In SC Catalog Item widget, add this code in Server Script. (in case you want to add in Client script, just google or let me know.)
var myProject = $sp.getParameter("project"),
myProduct = $sp.getParameter("product");
#3. Use myProject and myProduct to filter the Catalog Items.
Regards,
Prabhat