- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2022 02:14 PM
I have created a widget which is population html field on the portal but style is getting messed, its not showing color. ( u_class_name is html type field)
HTML :
<div id="modalTemplate" >
<div class="panel panel-default">
<div class="panel-heading">
</div>
<div class="panel-body wrapper-xl">
<div ng-bind-html="::data.name"></div>
</div>
</div>
Server Script :
(function() {
var gr = new GlideRecord('u_class');
gr.query();
if (gr.next()) {
var obj = {};
data.name = gr.getValue('u_class_name');
}
})();
Client Controller :
function($scope,spUtil, $uibModal) {
var c = this;
c.openModal = function() {
c.modalInstance = $uibModal.open({
templateUrl: 'modalTemplate',
scope: $scope
});
}
c.closeModal = function() {
c.modalInstance.close();
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2022 03:46 PM
Hello Sneha,
Please check this community thread:
Displaying html fields in widget - Service Portal
From what I can see, you need to do some changes to your client controller:
Client Controller :
function($scope,spUtil, $uibModal, $sce) {
var c = this;
// Display HTML field
$scope.data.name = $sce.trustAsHtml($scope.data.name);
c.openModal = function() {
c.modalInstance = $uibModal.open({
templateUrl: 'modalTemplate',
scope: $scope
});
}
c.closeModal = function() {
c.modalInstance.close();
}
}
Check if this works!
Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!
Best Regards,
Filipe Cruz

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2022 03:46 PM
Hello Sneha,
Please check this community thread:
Displaying html fields in widget - Service Portal
From what I can see, you need to do some changes to your client controller:
Client Controller :
function($scope,spUtil, $uibModal, $sce) {
var c = this;
// Display HTML field
$scope.data.name = $sce.trustAsHtml($scope.data.name);
c.openModal = function() {
c.modalInstance = $uibModal.open({
templateUrl: 'modalTemplate',
scope: $scope
});
}
c.closeModal = function() {
c.modalInstance.close();
}
}
Check if this works!
Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!
Best Regards,
Filipe Cruz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2022 03:57 PM
Can you please tell me what i am doing wrong in the server script. ideally its should take the current sys id of the record on the portal and each record(class) should displaying its own name (u_class_name) but right now its displaying one name on all the record ( on portal) and when i am closing the popup and opening again its not showing anything and records are fine on the backend table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2022 12:05 AM
Hello Sneha,
Your server side GlideRecord is supposed to return how many records?
Because you are doing an if(gr.next()) and not a while(gr.next()).
Can that be the cause?
Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!
Best Regards,
Filipe Cruz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2022 01:00 AM
Below is my table
Class id | Class name |
id1 | xyz |
id2 | zxy |
so, I have field on portal "class id" when i click that id its will open a popup and will show the class name and other records of that class id. which is not happening currently. right now with this code its showing class name for all the class id's and when i close and click for the popup again it is showing the blank window.