- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2018 09:36 PM
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!
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2018 09:42 PM
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>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2020 03:33 AM
Hi,
Found your code very helpful.
Need one help if that is possible.
In the Modal dialog i have the content dynamically pulled and displayed. In the same Modal i have a button called Update, on click of the button i need to set the updated modal content in the same place. Any idea how this can be achieved?