How can I pass a variable from client script to server script in a service portal widget?

Marton
Kilo Expert

I have built a query on client side, I want to use it on the server side querying process, is there a way to just pass that variable to server script?

6 REPLIES 6

The problem is, that I have to use it with this button

 

action: function(e, dt, node, config) {
$scope.server.get({action: "syncFromOsiris"}).then(function(returnedScope){
var data = returnedScope.data;
if(data.result == "Success"){
msTable.ajax.reload();
x.server.update();
}else{
spUtil.addErrorMessage("Error");
}
})
}

 

and it overrides the value on server side. 

If I log the variable on server side, I get:

variable = correct string

variable = undefined,

so the value gets lost. On server side I have:

if(input.action =="syncFromOsiris"){

//simple querying

}

Is there a way to insert that value in this function somehow?

i used this logic in an example i am running. i am trying to search for values using a modified version of the OOB search_page widget.

 

i pass the search term from the search input to the search_page widget and call it in the client script, i then pass that variable to the server.

 

when i set the var in server side statically to "siegel" i get a result, however when i pass "siegel" from the widget to the search, i get no results.  i see the search term is passing properly. but no results are given,  could it be formatting it in a way that is messing up the search?