The Zurich release has arrived! Interested in new features and functionalities? Click here for more

priority state and etc fields values are not included in the incident XML

KushalL
Tera Contributor

I exported the incident xml, and found the priority , state, impact and etc values are missing only the id is present.

<impact>3</impact>
<incident_state>1</incident_state>
<state>2</state>

i need to value to be present in the exported xml as mentioned below, how to achieve ?

<state>New</state>
 
5 REPLIES 5

AndersBGS
Tera Patron
Tera Patron

Hi @KushalL ,

 

Not sure how you have exported the XML, but I have just checked a random incident where priority is part of the XML <priority>1</priority>. Have you remembered that some fields are derived from task tabel?

 

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

Rafael Batistot
Kilo Patron

Hi @KushalL 

 

What you’re seeing is expected: when you export a record to XML in ServiceNow, reference fields and choice fields are stored by their internal values (numbers, sys_ids, etc.), not by their display values.

 

If you want to add display values with GlideRecord in a Script Include / Background Script. May you write a small script to export data with both the value and display value:

 

var gr = new GlideRecord("incident");
gr.get("<sys_id_of_incident>"); 
gs.print("State: " + gr.getValue("state") + " (" + gr.getDisplayValue("state") + ")");
gs.print("Impact: " + gr.getValue("impact") + " (" + gr.getDisplayValue("impact") + ")");
gs.print("Priority: " + gr.getValue("priority") + " (" + gr.getDisplayValue("priority") + ")");

Bhuvan
Kilo Patron

@KushalL 

 

It is expected behavior, take for example below incident record

Bhuvan_0-1755933602399.png

When you check xml for the record, you can see choice and reference data type fields would have integer value and sys_id value. 

Bhuvan_2-1755933664389.png

For example, take priority field which is a choice data type. In the incident record you can see display value is '5 - Planning' but backend database it would be stored as 5. Similarly, for reference fields, it would show sys ID in the database and you can use getDisplayValue() function to show the display value.

Bhuvan_3-1755933904362.png

 

If this helped to answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan

@KushalL 

 

Did you get a chance to review this ?

 

If my response helped to answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan