logo

NJP

Service portal: Add closed notes field in closed Ticket

Import · Jun 06, 2017 · article

Hello ,

I have seen few questions on community for adding close note in service portal ticket Service portal:Add closed notes field in closed Ticket .

Here is the solution :

If you are trying with form view it 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 this widget("Ticket Fields") and add additional script as described below :

I hope you are looking for below result :

image

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.

image

4. Select "Clone "Ticket Fields" option.

image

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

image

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

image

here is the script which you can copy:

HTML Template:

         

                            ${Close Notes}          

         
             
             
                 
{{data.close_notes}}

             

         

     

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 :

image

8. Now all required changes are complete.

Please test and share result

Also, this was for close notes field, you can also add other fields based on your requirement.

Let me know if you find any difficulties/question.

View original source

https://www.servicenow.com/community/developer-articles/service-portal-add-closed-notes-field-in-closed-ticket/ta-p/2330444