When using a widget in the ServiceNow Portal module, you can use the following example while taking data on the Client Script side and transferring it to the Server Script side.
We take the sc parameter from the URL and pass it to the server side.
Client Script side:
function($scope, $timeout) {
var c = this;
//
function Parametre(name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [null, ''])[1].replace(/+/g, '%20')) || null;
}
//alert(Parametre('aid'));
if ( Parametre('sc') != null ) {
c.data.sc=Parametre('sc');
c.data.action = "sorgula";
c.server.update().then(function(){
//c.data.action = undefined;
//c.data.sc = "";
});
}
//if
//
}
Server Side:
if( input.action == 'sorgula' ) {
//gs.addInfoMessage( 'KATALOG: ' + input.sc + ' action: ' + input.action );
var katalog=input.sc;
data.formlar = [];
data.kategoriler = [];
GetirCategory(katalog);
}
//if sorgulaysa

Share your experience
Got a question, a different solution or a note to add?
Log in or join us to write a comment.
Log in ↗︎Sign up ↗︎