How can I create a dialog window in Service Portal .

Snow Developer2
Mega Contributor

I have a requirement where I want a dialog window containing html contant to display on click of button in Service Portal.I am new to ServiceNow and have got to know that dialog does not work in portal. 

Please help!

1 ACCEPTED SOLUTION

Shashank Vashi1
Mega Guru
Mega Guru

Hi,

 

To create a dialog window in ServiceNow, Please use the below mentioned code in your widget in widget editor.Also please include $uibModal, and $scope in top function parameters if not already added.

 

Client Script:

 

var c=this;

c.openModal = function() {
c.modalInstance = $uibModal.open({
templateUrl: 'modalTemplate',
scope: $scope
});
}
c.openModalType = function() {
c.modalInstance = $uibModal.open({
templateUrl: 'modalTemplateType',
scope: $scope
});
}
c.closeModal = function() {
c.modalInstance.close();
}

 

HTML Template:

Please include the below code in html template:

<script type="text/ng-template" id="modalTemplateType">
<div class="panel panel-default" style="background:#fff;color:#00A0D0;font-weight:bold;">
<div class="panel-heading">
<h4 class="panel-title">What Type of System do I have?</h4>
</div>
<div class="panel-body wrapper-xl">
<ul>
<h5>test text</h5>
</ul>
</div>
<div class="panel-footer text-right">
<button class="btn btn-primary" ng-click="c.closeModal()">${Close}</button>
</div>
</div>
</script>

 

 

 

View solution in original post

10 REPLIES 10

rahulpandey
Kilo Sage
Hi, You can use bootstrap modal box. Portal variant is here https://serviceportal.io/modal-windows-service-portal/

Thanks for your help. I will check it 🙂

Though, you got an answer, I would still suggest you have a look on article.

Sure Sir. Thank you 🙂