- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2022 07:50 PM
Hi,
I am currently trying to send data like so:
Client:
c.data.x="some data";
Server:
console.log(input.x);
I get this error:
Server JavaScript error Cannot read property "x" from undefined
I was wondering how I could send it so that the server waits for the data from the client?
Thank you!
Solved! Go to Solution.
- Labels:
-
Scoped App Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2022 08:05 PM
Hi,
send like this; the info message in server should give you Hello
Client Side:
var serverRequest = {};
serverRequest.action = "my_action";
serverRequest.myValue = "Hello";
c.server.get(serverRequest).then(function(r) {
})
Server Side:
if(input && input.action == 'my_action'){
gs.addInfoMessage("My value" + input.myValue);
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2022 08:05 PM
Hi,
send like this; the info message in server should give you Hello
Client Side:
var serverRequest = {};
serverRequest.action = "my_action";
serverRequest.myValue = "Hello";
c.server.get(serverRequest).then(function(r) {
})
Server Side:
if(input && input.action == 'my_action'){
gs.addInfoMessage("My value" + input.myValue);
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2023 08:42 AM - edited ‎06-09-2023 08:52 AM
Hi @Ankur Bawiskar
I am Facing the issue that I'm not able to get the server side data, I used it this Script
HTML-code
<div>
<button ng-click="setMseDwn()">SUBMIT</button>
</div>
Client Side Script
Server Side Code
(function() {
if(input && input.action == 'my_action'){
console.log("My value" + input.myValue );
}
})();
Using in the Scoped Application.
Thanks & Regards
Abhijeet Burghate.