ServicePortal data passing

vidishaagarwal5
Tera Expert

How to pass data from Client Script to HTML? How to pass data from the Server Script to the Client Script

3 ACCEPTED SOLUTIONS

Ravi Gaurav
Giga Sage
Giga Sage

Hi @vidishaagarwal5 

for html {data.varariable_name}

for client var result = $scope.data.variable_name;

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

ï”— YouTube: https://www.youtube.com/@learnservicenowwithravi
ï”— LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/

View solution in original post

Hi @vidishaagarwal5 

 

All your doubts will be clear by reading your below Article :

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0686742

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

ï”— YouTube: https://www.youtube.com/@learnservicenowwithravi
ï”— LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/

View solution in original post

Sarthak Kashyap
Tera Guru

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

View solution in original post

3 REPLIES 3

Ravi Gaurav
Giga Sage
Giga Sage

Hi @vidishaagarwal5 

for html {data.varariable_name}

for client var result = $scope.data.variable_name;

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

ï”— YouTube: https://www.youtube.com/@learnservicenowwithravi
ï”— LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/

Hi @vidishaagarwal5 

 

All your doubts will be clear by reading your below Article :

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0686742

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

ï”— YouTube: https://www.youtube.com/@learnservicenowwithravi
ï”— LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/

Sarthak Kashyap
Tera Guru

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