Issues sending data from Client controller to Server in widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 01:10 PM
Hi!
I want to send some data to the server from the client, and have the server wait until it gets that data. This is the code I am currently trying:
Client Controller:
c.data.abc='Value';
c.func_name= function() {
c.server.update();
}
Server:
if (input) {
console.log("input");
gr.query('mapnumber', input.abc);
} else {
gr.query();
}
This code doesn't work, as it never goes into the if statement. Am I doing something wrong?
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 01:43 PM
Hi,
It looks like you maybe used this post as an example: https://community.servicenow.com/community?id=community_question&sys_id=e901d1afdb0aa7c0afc902d5ca96...
But ideally, you'd want to use ServiceNow documentation, unless the post was actually marked as Correct, then it may have a bit more weight to it.
If that is all you have in your client script, then that won't work. "c" needs to be defined.
Please refer to ServiceNow Developer tutorials, etc. for more assistance: https://developer.servicenow.com/dev.do#!/learn/learning-plans/paris/servicenow_application_develope...
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 02:04 PM
Hi! I do have "c" defined, but it still isn't working as expected. I'll look into the documentation as well.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 02:08 PM
Hi,
Sounds good. Here's an additional resource to help as well with examples: https://docs.servicenow.com/bundle/rome-servicenow-platform/page/build/service-portal/concept/widget...
and
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2022 09:49 AM
Hi
Thanks for marking my reply as Helpful.
If it also helped guide you Correctly, please also mark as Correct.
Thanks and take care! 🙂
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!