priority state and etc fields values are not included in the incident XML
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
I exported the incident xml, and found the priority , state, impact and etc values are missing only the id is present.
<state>2</state>
i need to value to be present in the exported xml as mentioned below, how to achieve ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
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/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
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") + ")");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago - last edited 4 weeks ago
It is expected behavior, take for example below incident record
When you check xml for the record, you can see choice and reference data type fields would have integer value and sys_id value.
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.
If this helped to answer your query, please mark it helpful & accept the solution.
Thanks,
Bhuvan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
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