How to retrieve value of a variable of catalog item in widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2022 11:15 PM
Hi,
I am new to widgets creation. I have created a widget to display the dynamic link on the catalog form.
Could you please help me to retrieve the value of variable and pass it in the dynamic link.
HTML:
<div>
<!-- your widget template -->
<a href = "/src?p={{c.populateRole()}}" target="_blank">Click Here</a>
</div>
Server script:
(function() {
/* populate the 'data' object */
/* e.g., data.table = $sp.getValue('table'); */
data.role = getRole();
function getRole(){
var persona = $scope.page.role;
var assGrps = new GlideRecord("table_name");
assGrps.addQuery('persona', persona);
assGrps.query();
if(assGrps.next()){
var secGrp = assGrps.security_group;
var role = new GlideRecord("sys_group_has_role");
role.addQuery("group", secGrp);
role.query();
if(role.next()){
return role.sys_id;
}
}
}
})();
Client Controller:
api.controller=function() {
/* widget controller */
var c = this;
c.populateRole = function(){
c.roleSysyId = c.date.role;
return c.roleSysId;
};
};
Thanks in advance.
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-19-2022 10:38 PM
Hello @Navya Yetukuri
Below YouTube videos have demo for the same, this should be helpful.
https://www.youtube.com/watch?v=sr_gqqxllRM
https://www.youtube.com/watch?v=pj68yoh0arI
https://www.youtube.com/watch?v=qMo-30KbtWw
The Serviceportal.io website currently looks to be down, you can check this later.
https://serviceportal.io/communicating-between-the-client-script-and-the-server-script-of-a-widget/
Thank you,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2022 05:36 AM
 in portal catalogue item,if i select any company that data from client controller send to server script to glide table,can please send code for this