0

HTML:

<div>
 <button class="btn btn-primary" ng-click="c.openModal()">${Open Modal}</button>
</div>
  <script type="text/ng-template" id="modalTemplate">
 <div class="panel panel-default">
  <div class="panel-heading">
   <h4 class="panel-title">Modal Window</h4>
    </div>
  <div class="panel-body wrapper-xl">
   Close Notes : <input type="text"id="close_notes" class="form-group" ng-model="c.data.model.close_notes">
    </div>
        <button class="btn btn-primary" 
  <div class="panel-footer text-right" ng-click='submitTicket()'>${Submit}</button>
   <button class="btn btn-primary" ng-click="c.closeModal()">${Close Modal}</button>
  </div>
 </div>
</script>

Server Script:

(function() {
    var createCase = function(case_data) {
        gs.addInfoMessage("case_data.support" + case_data.support);
        var gr = new GlideRecord("sys_useer");
        gr.initialize();
        gr.name = case_data.support;
        gr.insert();
    };
    if (input.action === 'newCase') {
        var case_data = input.case_data;
        try {
            createCase(case_data);
            data.success = true;
        } catch (e) {
            data.err = e;
            data.success = false;
        }
    }
})();

Client Controller

function($uibModal, $scope) {
    var c = this;
    c.openModal = function() {
        c.modalInstance = $uibModal.open({
            templateUrl: 'modalTemplate',
            scope: $scope
        });
    }
    c.closeModal = function() {
        c.modalInstance.close();
    }
    $scope.submitTicket = function() {
        var program = document.getElementById("close_notes").value;
        if (program != "") {
            c.server.get({
                action: 'newCase',
                notes: program
            }).then(function(response) {
                 alert("submit")
             });
        } else {
            alert("Program is Mandatory Field");
        }
    }
   }

Output

How to create popup in widget Service Portal ServiceNow code
Working Code Asked question July 6, 2023