c.server.update() doesn't work and i don't know why
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2018 06:46 AM
My client controller capture event from another widget and update the server by c.server.update() but it doesn't work,
the server side has no refresh and no output.
Client side(call c.server.update()):
server side:
(No 'kpi data' and 'submit' as console output )
It's urgency and need your kind kelp!!
- Labels:
-
Service Portal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2018 07:58 AM
HI,
At server side can you use gs.log instead of console.log.
Thanks,
Ashutosh Munot

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2018 09:32 AM
Hi,
Can you try removing console.log('kpi data') from top line and add it after if ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2018 10:06 AM
Hello,
try something like this :
c.data.submitdata= 'test data';
var unregister = $scope.$on('test event',c.server.update().then(function(response){
// remaining code;
}));
mark this answer as correct if it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2018 10:08 AM
I think what may be missing is assigning the new values to the necessary variable.
As you are aware c.server.update() updates the server side via the input object but what it doesn't do automatically is reset the data object. For example if a variable is being used on the client side c.data.needUpdating or even just data.needUpdating (set in the html template) then that variable would need to be updated in the input object set in the server side or in the promise of c.server.update();
Examples: Updating variable server side:
if(input && input.something){
data.needUpdating = someFunc(input.something)
}
function someFunc(inp){
// do some stuff with inp
... using inp for something
return answer;
}
Or updating via promise
Server side
if(input && input.something){
data.placeholder = someFunc(input.something)
}
function someFunc(inp){
// do some stuff with inp
... using inp for something
return answer;
}
client side promise
$scope.someFunc = function (){
c.data.something = "something";
c.server.update().then(function(resp){
c.data.needUpdating = resp.placeholder;
});
}