The CreatorCon Call for Content is officially open! Get started here.

How to setTimeout to call function in Service Portal

Nancy8
Giga Contributor

My requirement is to set time for 5000 in Client Script in widget.  I have two siample code, but they doesn't work.  can any expert give me some advise

function ($scope, $http, spUtil, nowAttachmentHandler, $rootScope, $sanitize, $uibModal, $window, $sce) {
var c = this;

//sample 1 

wiindow.setTimeout(getRecord, 3000);

function getRecord(){
spUtil.addInfoMessage("Test=============");
}
}

 

//sample 2

$timeout(function() {
var url = c.data.url + 'u_sarf_pdf.do?PDF&sys_id=' + sys_id;
spUtil.addInfoMessage("tt==============");
//window.open(url);
}, 5000);

}

 

3 REPLIES 3

Mike Patel
Tera Sage

below works for me 

spUtil.addInfoMessage("Your message here", 3000);

 

c.Reopen = function(action) {
c.data.action = action;
c.server.update().then(function() {
c.data.action = undefined;
spUtil.addInfoMessage("Incident has been Reopened", 3000);
c.modalInstance.close();
});
};

Hi Mike,

do you call c.Reopen function from html template?  What is function paramrer - action value?

Yes. Below is template

<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">Provide a reason to Reopen Ticket</h4>
</div>
<div class="panel-body wrapper-xl">
<form name="modalTemplateReopen" ng-submit="c.Reopen('reopen')">
<div class="form-group">
<textarea required sp-autosize="true" ng-required="true" ng-model="data.reopenComments" id="reopenComments" placeholder="Comments required" class="form-control ng-pristine ng-valid ng-scope ng-empty ng-touched" aria-invalid="false" style="overflow: hidden; word-wrap: break-word; resize: horizontal;"></textarea>
</div>
<input class="btn btn-primary" type="submit" />
</form>
</div>
</div>