// 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

 

// FEEDBACK

Was this useful?

Your rating shows how helpful this note is to other readers.

Was this useful?

Click the stars to rate.

Average rating 0 / 5. Total votes: 0

No one has rated this post yet. Be the first!

Sorry this post was not helpful.

Your feedback is valuable to us.

How can we make this post more helpful?

// JOIN THE CONVERSATION

Share your experience

Got a question, a different solution or a note to add?

// KEEP READING

One more note.

All posts ↗︎