Passing variables from Client to Server side in Widget with Augular?
This content was last updated in 2018. It may still be useful, but could contain outdated information. Please confirm its accuracy before relying on it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2017 09:00 PM
Hi folks,
I am stuck at a widget where a client side script is having difficulty to pass variable to the server, wondering if I could get any advice?
I have a widget "Data table 3" consisting of Server/Client scripts. In the client side, a variable c.data.c_topic need to pass to the server (see the highlighted below)
In the server side, try to display the variable by gs.addInfoMessage
As it can be seen, the data.c_topic shows as undefined.
I may need more details please let me know if so.
Thanks
- Labels:
-
Personal Developer Instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2017 12:59 PM
Thank you very much and do you know how to call ajax call from custom widget?
The ajax script include works just fine when I call it from incident form after adding onLoad() script include to the incident form.
However, when I try to call from custom widget nothing nothing happens, but throws error in the console.
/************* Ajax Script Include **************/
var BDO_Get_KowledgeBases_ID = Class.create();
BDO_Get_KowledgeBases_ID.prototype = Object.extendsObject(AbstractAjaxProcessor, {
get_kb_ID: function(){
return ("Thanks for your help Ujjawal Vishnoi....");
},
type: 'BDO_Get_KowledgeBases_ID'
});
/************* Widget Client Script **************/
var ga = new GlideAjax('BDO_Get_KowledgeBases_ID'); // calling ajax
ga.addParam('sysparm_name','get_kb_ID'); // calling get_kb_ID method that defined above
ga.addParam('sysparm_kb_sys_id',"1bfe72f2de72f2dbfe4e72f2dbfe4bfe4"); // passing "sysparm_kb_sys_id"
ga.getXML(Get_KB_ID); // calling callback function
// the callback function for returning the result from the server-side code
function Get_KB_ID(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
}
Thanks for your help
Dave Jookhuu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 03:45 AM
in client
c.data.x="some data";
in server
you will get the value of x as input.x
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2018 01:36 PM
On a quick look I see have gs.addInforMessage() instead of gs.addInfoMessage(). Should that be the problem?