<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Widget Client script in ITSM forum</title>
    <link>https://www.servicenow.com/community/itsm-forum/widget-client-script/m-p/2664481#M502371</link>
    <description>&lt;LI-CODE lang="javascript"&gt;\&lt;/LI-CODE&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please help me understand what is done in the below script in the function openModalResolve?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know whats happening in the form, there is form button, on click of the button option there is small dialog box opens, where user can enter comments and submit. But I need help is understanding this piece of code. what is&amp;nbsp;modalInstance , what is&amp;nbsp;$uibModal, what is&amp;nbsp;templateUrl?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;api.controller = function($uibModal, $scope, spUtil) {
    /* widget controller */
    var c = this;
    c.uiAction = function(action) {
        c.data.action = action;

        c.server.update().then(function() {
            c.data.action = undefined;
            //spUtil.addInfoMessage("Incident has been cancel", 3000);
        });
        c.modalInstance.close();
    };
    c.openModalResolve = function() {
        if (c.data.showmodal) {
            c.modalInstance = $uibModal.open({
                templateUrl: 'modalTemplateCancelNew',
                scope: $scope
            });
        } else {
            c.modalInstance = $uibModal.open({
                templateUrl: 'CancelactivecontractsourcingNew',
                scope: $scope
            });
            c.data.user = {
                value: '',
                displayValue: ''
            };

        }

    };

    c.closeModal = function() {
        c.modalInstance.close();
    };



};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Sep 2023 05:41:25 GMT</pubDate>
    <dc:creator>Sruthi17</dc:creator>
    <dc:date>2023-09-07T05:41:25Z</dc:date>
    <item>
      <title>Widget Client script</title>
      <link>https://www.servicenow.com/community/itsm-forum/widget-client-script/m-p/2664481#M502371</link>
      <description>&lt;LI-CODE lang="javascript"&gt;\&lt;/LI-CODE&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please help me understand what is done in the below script in the function openModalResolve?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know whats happening in the form, there is form button, on click of the button option there is small dialog box opens, where user can enter comments and submit. But I need help is understanding this piece of code. what is&amp;nbsp;modalInstance , what is&amp;nbsp;$uibModal, what is&amp;nbsp;templateUrl?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;api.controller = function($uibModal, $scope, spUtil) {
    /* widget controller */
    var c = this;
    c.uiAction = function(action) {
        c.data.action = action;

        c.server.update().then(function() {
            c.data.action = undefined;
            //spUtil.addInfoMessage("Incident has been cancel", 3000);
        });
        c.modalInstance.close();
    };
    c.openModalResolve = function() {
        if (c.data.showmodal) {
            c.modalInstance = $uibModal.open({
                templateUrl: 'modalTemplateCancelNew',
                scope: $scope
            });
        } else {
            c.modalInstance = $uibModal.open({
                templateUrl: 'CancelactivecontractsourcingNew',
                scope: $scope
            });
            c.data.user = {
                value: '',
                displayValue: ''
            };

        }

    };

    c.closeModal = function() {
        c.modalInstance.close();
    };



};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 05:41:25 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/widget-client-script/m-p/2664481#M502371</guid>
      <dc:creator>Sruthi17</dc:creator>
      <dc:date>2023-09-07T05:41:25Z</dc:date>
    </item>
    <item>
      <title>Re: Widget Client script</title>
      <link>https://www.servicenow.com/community/itsm-forum/widget-client-script/m-p/2665067#M502427</link>
      <description>&lt;P&gt;c.modalInstance is the variable representation of the entire modal that is displayed by $uibModal so it's easier to call back to it and interact with it programmatically.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$uibModal is an angular method of creating a modal window. This can be used in Service Portals instead of the spModal modal API provided by ServiceNow which may be easier to work with. Depends on a persons familiarity with either and intended use.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;templateUrl is a parameter passed to the modal that determines what exactly to load. This could be an angular ng-template included in the related list or something else embedded on the page through the HTML rendered.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Angular ng-template example: Knowledge Article Content (kb-article-content) widget&lt;/LI&gt;&lt;LI&gt;Embedded example:&amp;nbsp;&lt;A href="https://serviceportal.io/modal-windows-service-portal/" target="_self"&gt;https://serviceportal.io/modal-windows-service-portal/&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a thread that has a lot more information about $uibModal:&amp;nbsp;&lt;A href="https://www.servicenow.com/community/developer-forum/how-to-use-uibmodal-in-service-portal/m-p/1589730" target="_self"&gt;https://www.servicenow.com/community/developer-forum/how-to-use-uibmodal-in-service-portal/m-p/1589730&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 13:26:40 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/widget-client-script/m-p/2665067#M502427</guid>
      <dc:creator>SVimes</dc:creator>
      <dc:date>2023-09-07T13:26:40Z</dc:date>
    </item>
  </channel>
</rss>

