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

This is an example of incident record:



https://<INSTANCE_NAME>.service-now.com/<PORTAL_URL>?id=form&sys_id=<SYS_ID_OF_INCIDENT>&table=incid...



You need to update below attributes in above URL:



<INSTANCE_NAME>


<SYS_ID_OF_INCIDENT>



Also, you can try to use "Simple List" widget.


Hi,


Thank you for this hint, it is very helpfull.



Could you please show me how to make the field mandatory?



Thank you



Regards,



Miora


chirag_bagdai
ServiceNow Employee
ServiceNow Employee

Hi Miora,



Good to know



For making field mandatory, you can use "Catalog UI Policy" if you are using catalog item/record producer else you can "UI Policy" for table.


Hi Chirag,



Thanks, this is really useful



Is there a way to put the closure notes in the conversation history widget as well?



Cheers,


Anna