// ServiceNow

Service-Now Client Script to Server Script via Widget

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

 

// JOIN THE CONVERSATION

Share your experience

Bir sorunun, farklı bir çözümün veya eklemek istediğin bir notun var mı? Giriş yapmadan da yazabilirsin.

// KEEP READING

One more note.

All posts ↗︎