How can I pass a variable from client script to server script in a service portal widget?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2019 05:32 AM
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?
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2019 07:26 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2021 12:28 PM
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?