pass value from server to client controller widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2020 05:51 AM
need to pass the value from server to client
client controller
c.uiAction = function(sysid) {
c.data.delegateid=sysid;
c.server.update();
}
Server:
data.delegatename="";
if (input && input.action) {
var action = input.action;
if (data.table == 'sys_user_delegate') {
var delremove=new GlideRecord(data.table)
delremove.addQuery('sys_id',input.delegateid);
delremove.query();
if(delremove.next())
{
console.log(delremove.delegate+"deleted user");
data.delegatename=delremove.delegate;
if (action == 'remove')
{
//delremove.deleteRecord();
}
}
}
}
console.log(data.delegatename+"goo nn///")
I need to pass data.delegatename to client controller.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2020 05:57 AM
It looks like you're already passing it, you just need to access it from the client with c.data.delegatename
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2020 06:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2020 06:10 AM
data.delegatename should be available with the following syntax:
HTML:
<p>{ {data.delegatename} }</p>
Client Script:
var delegatename = c.data.delegatename;
If you would like to use data.delegatename immediately after it is retrieved from the server you can use the following:
c.uiAction = function(sysid) {
c.data.delegateid = sysid;
c.server.update().then(function(){
doSomeThing(c.data.delegatename);
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2020 06:47 AM