Service portal:Add closed notes field in closed Ticket

gomathyshankar
Tera Contributor

Hi

I need to populate the closed notes field for closed incident in service portal.Could some one please help.

1 ACCEPTED SOLUTION

chirag_bagdai
ServiceNow Employee
ServiceNow Employee

Hello,



Form layout or view won't help here because in SP, "Ticket Fields" widget can only show   'number,state,priority,sys_created_on' fields but if you want close notes field then you need to clone the widget and have to add code for close note.



I hope you are looking for below output :



Screen Shot 2017-05-25 at 11.19.54 AM.png



If yes, you can follow below steps :



1. From left navigation. Select "Service Portal Configuration âžš"


2. New tab should open and then select "Widget Editor"


3. Select "Ticket Fields" in Edit an existing widget list.


Screen Shot 2017-05-25 at 11.34.20 AM.png


4. Select "Clone "Ticket Fields" option.


Screen Shot 2017-05-25 at 11.34.46 AM.png


5. Provide name/id for your new custom widget.


Screen Shot 2017-05-25 at 11.35.12 AM.png


6. You need to make changes in "HTML Template" and in "Server Script" (script changes are selected as below):


Screen Shot 2017-05-25 at 11.37.18 AM.png


here is the script which you can copy:


HTML Template:


<div ng-if="data.close_notes != '' " ng-init="variable_toggle=true">


          <h4 ng-click="variable_toggle = !variable_toggle" style="cursor: pointer;">


              <span style="font-size: 12px;" class="glyphicon"


                          ng-class="{'glyphicon-chevron-down': !variable_toggle, 'glyphicon-chevron-up': variable_toggle}"></span>


              ${Close Notes}


          </h4>


         


          <div ng-if="variable_toggle">


              <hr>


              <div class="m-b break-word">


                  <div>{{data.close_notes}}</div>


              </div>


          </div>


      </div>



Server Side Script:


  data.close_notes = '';


  data.close_notes = $sp.getFields(gr, 'close_notes');


  if(data.close_notes != '') {


            data.close_notes = data.close_notes[0].display_value;


  }



7. You can replace OOB "Ticket Fields" widget from ticket page with your custom widget.


        7.1 - Goto "Service Portal Configuration" from left navigation and select "Page Editor".


        7.2 - Select "Ticket" page from the search list.


        7.3 - Select "Instance 2" and update Ticket Fields widget with new widget :


Screen Shot 2017-05-25 at 12.00.35 PM.png



8. Now all required changes are complete.



Note: ticket page can be use for other tables like problem so close note will also get visible for problem tickets also if you don't want you can add condition in the server script.


if data.close_notes is empty then "Close Note" will not be visible.



Please let me know if you find any difficulties.


View solution in original post

13 REPLIES 13

chirag_bagdai
ServiceNow Employee
ServiceNow Employee

Hello,



Form layout or view won't help here because in SP, "Ticket Fields" widget can only show   'number,state,priority,sys_created_on' fields but if you want close notes field then you need to clone the widget and have to add code for close note.



I hope you are looking for below output :



Screen Shot 2017-05-25 at 11.19.54 AM.png



If yes, you can follow below steps :



1. From left navigation. Select "Service Portal Configuration âžš"


2. New tab should open and then select "Widget Editor"


3. Select "Ticket Fields" in Edit an existing widget list.


Screen Shot 2017-05-25 at 11.34.20 AM.png


4. Select "Clone "Ticket Fields" option.


Screen Shot 2017-05-25 at 11.34.46 AM.png


5. Provide name/id for your new custom widget.


Screen Shot 2017-05-25 at 11.35.12 AM.png


6. You need to make changes in "HTML Template" and in "Server Script" (script changes are selected as below):


Screen Shot 2017-05-25 at 11.37.18 AM.png


here is the script which you can copy:


HTML Template:


<div ng-if="data.close_notes != '' " ng-init="variable_toggle=true">


          <h4 ng-click="variable_toggle = !variable_toggle" style="cursor: pointer;">


              <span style="font-size: 12px;" class="glyphicon"


                          ng-class="{'glyphicon-chevron-down': !variable_toggle, 'glyphicon-chevron-up': variable_toggle}"></span>


              ${Close Notes}


          </h4>


         


          <div ng-if="variable_toggle">


              <hr>


              <div class="m-b break-word">


                  <div>{{data.close_notes}}</div>


              </div>


          </div>


      </div>



Server Side Script:


  data.close_notes = '';


  data.close_notes = $sp.getFields(gr, 'close_notes');


  if(data.close_notes != '') {


            data.close_notes = data.close_notes[0].display_value;


  }



7. You can replace OOB "Ticket Fields" widget from ticket page with your custom widget.


        7.1 - Goto "Service Portal Configuration" from left navigation and select "Page Editor".


        7.2 - Select "Ticket" page from the search list.


        7.3 - Select "Instance 2" and update Ticket Fields widget with new widget :


Screen Shot 2017-05-25 at 12.00.35 PM.png



8. Now all required changes are complete.



Note: ticket page can be use for other tables like problem so close note will also get visible for problem tickets also if you don't want you can add condition in the server script.


if data.close_notes is empty then "Close Note" will not be visible.



Please let me know if you find any difficulties.


Thanks chirag.bagdai   it really help me.


Hi,



Any idea how to make these fields editable and update the record?


Regards
Harish

There is no features of editing fields on "ticket" page, if you want you need to create your own copy.



Else the best way is to redirect your users to "form" page where they can modify other fields also. You may find more details in below thread.



https://community.servicenow.com/thread/264726


Could you plz let me know the steps to be followed for the link you had mentioned?


Regards
Harish