How to add button in Service portal?

salu
Mega Guru

Hello,

We need to add a button like continue.Earlier we used add it by a macro variables but service portal it won't support.can some suggest an alternate method for it?

And also on click I need a generate a page which shows some information.In normal CMS we did it like UI pages through jelly script.Can someone help me on this.

The below image show what am exactly looking for

Thanks

Saranya

1 ACCEPTED SOLUTION
26 REPLIES 26

HTML:


                      <div><button type="button" class="btn" ng-click="btnClicked('reopen')">Reopen</button></div>


                      <div><button type="button" class="btn" ng-click="btnClicked('resolve')">Resolve</button></div>


                      <div><button type="button" class="btn" ng-click="btnClicked('close')">Close</button></div>



Client Script:


function($scope) {


var c = this;


  $scope.btnClicked = function(act) {


        c.data.actionClicked = act;


        c.server.update();


  };


}



Server Script:


(function() {


 


  if(input.actionClicked != '') {


          var recInc = new GlideRecord("incident");


        recInc.get("<sys_id of current incident>");


        if(input.actionClicked == 'reopen'){


                  recInc.state = 8;


        }


        else if(input.actionClicked == 'resolve'){


                  recInc.state = 6;


        }


        else if(input.actionClicked == 'close'){


                  recInc.state = 7;


        }


        recInc.update();


  }




})();


Hi Hardik,



Thank you. Your solution is quite useful but it didn't resolve my issue. After clicking on the buttons still nothing is happening. No Reloading of page or Change in incident state is happening.  


haseena ayesha
Kilo Guru

Hi


Saranya,



please go through the bellow link it may be help full to you,


Create custom action buttons in Service Portal - ServicePortal.io - Service Portal, CMS, and Custom ...




Thanks&Regards


Haseena.


Thank you Haseena,



This is finally working fine. I was searching and try for this solution for more than a week. Thanks a lot.