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

Not Catalog Item its a record producer


phanindra1
Giga Contributor

Hi Saranya,



I believe below hints might assist you.



1. create a new widget for button


2. In HTML display the button and use ng-click to run function1


3. In side, client script fill function 1 with   window.open to open a dialog box.


4. Embed this new widget in sc_cat_item



Glad to help you if you need any more assistance.



Regards,


Phani


Hello bhani,


I need to have   my new button and hide the submit button from the catalog item,can you have any solution for this


Thanks


Saranya


Hi Saranya,



Your requirements looks a good fit for a custom widget altogether than using a record producer.   Widgets will give you a flexibility to to have your own form design and create records in system similar to record producer.   The only point your have keep in mind is when users click on the record producer from the catalog, the page is redirected to that widget.   For this you can follow the steps below:


1. Create table 'u_catalog_to_widget_mapping' as below:


                  - Active : True/False


                  - Catalog Item : Reference to Catalog Item table


                  - SP Page : Reference to Page table



2. Design a new Widget form and a new page in your service portal.


3. Add a record in 'u_catalog_to_widget_mapping' table for the record producer to the new widget page mapping.


4. Clone 'SC Catalog Item' widget and add following BOLD lines:


                  Client Script:


                          function ($scope, $http, spUtil, nowAttachmentHandler, $rootScope, $location) {


                                      if($scope.data.spPage!=''){


                                                  $location.search({id: $scope.data.spPage, sys_id: $scope.data.sys_id});


                                          }


      Server Script:


               


                          (function() {


                              if (input)


                                          data.sys_id = input.sys_id;


                              else


                                          data.sys_id = $sp.getParameter("sys_id") || $sp.getParameter('sl_sys_id');


                              data.spPage = hasPageRedirect(data.sys_id.toString());



function hasPageRedirect(cat_sysid){


  var spGR = new GlideRecord('u_catalog_to_widget_mapping');


  spGR.addQuery('u_cat_item',cat_sysid);


  spGR.addQuery('u_active',true);


  spGR.query();


  if(spGR.next()){


  return spGR.u_sp_page.getDisplayValue().toString();


  }else{


  return '';


  }


}




This way you will able to continue using your Catalog list but redirect to custom widgets for record producers.



- Hardik Vora


Hello Hardik,


Thank you very much for this solution.



I already designed my whole page in the record producer.Now am facing difficulties only to hide and show my two buttons.



I have created a check box field in the record producer.When the check box is true I need to show my submit button and when its false I need to show my continue button.



Do you know how can I pass this server side?



In the catalog Item widget,g_form.getDisplayValue is working.How can I pass this in server side?


Can you please help me in this?



Thanks


Saranya