- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2017 03:36 AM
Client side:
Server side:
i am getting the values from array in html but I want to use it in client script.
I want to send the values which are in while loop of gliderecord and need to retrieve it in client script. Please help me in both - sending and retrieving. Many thanks.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2017 05:15 AM
The common practice is to use the data object (noted in the comments) in your server script.
Example:
data.myNumber = 10;
data.myID = gs.getUserID();
Then in the client script,
var userID = c.data.myID;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2017 04:07 AM
Thanks Chuck that helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2019 07:01 PM
Hi Chuck,
great post. Another question...how can I get the data object to show in a popup modal? I've got c.data.name defined in my client script, but if I put {{c.data.name}} into my modal script it's not recognized. Thanks Chuck!
here's my popup modal script in the HTML of the widget:
<!--popup modal-->
<script>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">Tech Hub</h4>
</div>
<div class="panel-body wrapper-xl">
Thank you, a ticket has been created on your behalf. You are number {{c.data.count}} in the queue. You will now be redirected to the home screen.
</div>
<div class="panel-footer text-right">
<button class="btn btn-primary" ng-click="c.closeModal()">${Close}</button>
</div>
</div>
</script>
<!--end popup modal-->
and here's the client script triggering the popup:
c.server.update().then(function(response){
var queueNumber = c.data.count;
var userName = c.data.name;
alert('userName is '+userName+' and queueNumber is '+queueNumber);
//popup modal
c.modalInstance = $uibModal.open({
templateUrl: 'modalTemplate',
scope: $scope
});
//end popup modal
setTimeout(myFunction, 9000);
function myFunction(){
$window.location.href = 'https://dev54219.service-now.com/th_proto?id=techhub_index';
}
c.data = {};
$scope.c.affected_user.value = '';
}) }
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2025 04:22 AM
Instead of declaring variable as var variable_name, declare it as data.variable_name, and use it as data.variable_name in client side and in HTML.