- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2025 11:20 PM
How to pass data from Client Script to HTML? How to pass data from the Server Script to the Client Script
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2025 11:23 PM
for html {data.varariable_name}
for client var result = $scope.data.variable_name;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2025 11:25 PM
All your doubts will be clear by reading your below Article :
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0686742
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2025 11:33 PM
Hi @vidishaagarwal5 ,
#From Client to HTML:
Client side
c.data.name = "ServiceNow";
HTML:
<h4>{{c.data.name}}"</h4>
#From Server to Client
Server Side add below code:
data.name = "ServiceNow";
Client add below code:
var name = c.data.name;
alert("Name = " + name);
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2025 11:23 PM
for html {data.varariable_name}
for client var result = $scope.data.variable_name;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2025 11:25 PM
All your doubts will be clear by reading your below Article :
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0686742
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2025 11:33 PM
Hi @vidishaagarwal5 ,
#From Client to HTML:
Client side
c.data.name = "ServiceNow";
HTML:
<h4>{{c.data.name}}"</h4>
#From Server to Client
Server Side add below code:
data.name = "ServiceNow";
Client add below code:
var name = c.data.name;
alert("Name = " + name);
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2026 07:15 AM
Hi @vidishaagarwal5 ,
1.1 From Client side to Html
Client side code
api.controller=function() {
/* widget controller */
var c = this;
c.table = "Incident";
};
HTML
<div>{{c.table}}</div>
1.1 Another way is to define $scope and access directly in HTML
api.controller=function($scope) {
/* widget controller */
var c = this;
$scope.table = "Incident";
};Html
<div>{{table}}</div>
3.From Server to Client
Server side code
data.table = "incident";Html code
<div>{{data.table}}</div>
Please mark helpful