Service Portal widgets: pass stuff from html to client, server to html, etc

Server:

data.closedIssuesList = []; var grIncsClosed= new GlideRecord('incident'); grIncsClosed.addInactiveQuery(); grIncsClosed.addQuery(sQuery); grIncsClosed.orderByDesc('closed_at'); grIncsClosed.setLimit(iLimit); grIncsClosed.query(); iLimit=grIncsClosed.getRowCount();//--uncomment if want to limit to initial iLimit value while (grIncsClosed.next()){ var object_c = {}; object_c.number=grIncsClosed.number+""; object_c.sys_id=grIncsClosed.sys_id+""; object_c.short_description=grIncsClosed.short_description+""; object_c.sys_created_on=grIncsClosed.sys_created_on+""; object_c.sys_updated_on=grIncsClosed.sys_updated_on+""; object_c.assigned_to=grIncsClosed.assigned_to+""; data.closedIssuesList.push(object_c); //gs.addInfoMessage(sMsgPadder + object_c.number); }

HTML:

<div ng-repeat="closedTicket in ::data.closedIssuesList" > <div class="panel-body b-b result-item" style="background-color:#F2FBFE"> <a href="?id=form&sys_id={{closedTicket.sys_id}}&table=incident"><span class="mi-sd">{{closedTicket.short_description}}</span></a><br/> <span class="mi-fi">Issue Number: {{closedTicket.number}}</span> <span class="mi-fi">Created: {{closedTicket.sys_created_on}}</span> <span class="mi-fi">Updated: {{closedTicket.sys_updated_on}}</span> <button class="btn btn-default" style="float: right;background-color:#145896;color:#F2FBFE;font-size:14px" ng-click="mi_viewRecord(${closedTicket.sys_id})">View issue</button> </div> </div>






==================================


Server / HTML:

<button ng-click="mi_viewRecord(${closedTicket.sys_id})" >View issue</button>

Client controller:

function($scope)
{
$scope.mi_viewRecord = function (issueSYSID){ var sLink="?id=form&sys_id="+issueSYSID+"&table=incident"; //alert(sLink); window.open(sLink, '_self'); } }





==================================

HTML: 

<div id="mi-closed-tickets" style="display:none" ng-model = "c.closedList"> <!-- ... --> </div>



<button id="mi-button-closed" class="btn btn-default" ng-click="mi_showClosed()">Closed Issues</button>

Client controller:

$scope.mi_showClosed = function() { c.resultsList='My closed issues'; document.getElementById("mi-closed-tickets").style.display="block"; document.getElementById("mi-open-tickets").style.display="none"; }




or use:

angular.element($('#tbl_name')).val()

or 

$("mi-open-tickets").style.display="none";

==================================


Comments

Popular posts from this blog

GlideRecord setValue

Running transform maps asynchronously

Post a command to the ECC queue for the mid server to initiate a powershell file copy