Service Now Portal Get Response from server side to client controller
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2017 03:23 PM
Hey Folks,
I am trying to call server script to execute via c.server.update which is working perfectly but I am unable to use RESPONSE in c.server.update().then(function(response) parameter
I have returned data ; in server code
and writing
Server Side
if (sys_id) {
data.sys_id = sys_id;
data.status = "success";
gs.log("Logs "+data.sys_id + data.status);
//data.message = gs.getMessage("Your request has been submitted and is pending review. You will receive an email when your request is processed.");
} else {
data.status = "error";
}
return data;
Client Side
if (response.status == 'success') {
spUtil.addInfoMessage = ('The Request has been submitted');
}
Log is coming but info message is not getting displayed
Kindly help
Thanks & Regards
Nitish Goel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2017 03:34 PM
try this:
c.server.update().then(function(response) {
if (c.data.status == 'success') {
spUtil.addInfoMessage = ('The Request has been submitted');
}
});
//Göran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2017 07:35 AM
Hi Goran
Already tried that but still not working
Thanks
Nitish Goel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2017 12:03 PM
Why don't you just display the info message on the server instead using gs.addInfoMessage('The Request has been submitted').
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2017 05:34 AM
Hi Nathan
First of all thanks for your amazing work on service now portal
Yes that would work but I will have some further enhancements in coming future from client which will be based on the response received from the server's end
I thought since it is a param in c.update.server method so there should not be any problem in receiving one
Thanks
Nitish Goel