Skip to main content

Exporting Sysids to a spreadsheet (CSV web service)

Exporting Sysids to a spreadsheet (CSV web service)

really useful post on how to get sysids added as a column to a CSV export (CSV web service)
https://developer.servicenow.com/blog.do?p=/post/exporting-data-with-sys-ids/


in a nutshell:

- edit the system property

SYSPARM_DEFAULT_EXPORT_FIELDS

to add in the sys id column, or just add as a parameter to the URL like so:
https://instance.service-now.com/incident_list.do?CSV&sysparm_default_export_fields=all

- fire the URL at the instance, e.g. 'active tickets where vendor = <a vendor>', examples:
https://instance.service-now.com/incident.do?CSV&sysparm_query=priority=1^active=true

https://instance.service-now.com/incident.do?CSV&sysparm_default_export_fields=all&sysparm_query=priority=1^active=true

https://instance.service-now.com/incident.do?CSV&CSV&sysparm_default_export_fields=all&sysparm_query=active=true^u_vendor=91c6f451371e420041c5616043990eee


this format seems to work also without editing the sys properties:


https://<instance>.service-now.com/incident.do?CSV&sysparm_query=u_vendor=91c6f451371e420041c5616043990eee&sysparm_fields=number,sys_id,correlation_display,correlation_id,u_vendor,u_vendor_group,u_vendor_reference_number


example on sys_choice table:

https://<instance>.service-now.com/sys_choice.do?CSV&sysparm_query=name=problem^ORname=problem_task^element=state^inactive=false&sysparm_fields=name,sys_id,label,value




Comments

  1. You have done good work by publishing this article here. I found this article too informative, and also it is beneficial to enhance our knowledge. Grateful to you for sharing an article like thischina export data

    ReplyDelete
  2. Excellent post. I really enjoy reading and also appreciate your work. This concept is a good way to enhance knowledge. Keep sharing this kind of articles, Mexico Export Data. Thank you.

    ReplyDelete
  3. This post is so useful and valuable to increase our knowledge. I am happy that you have shared great info with us. Grateful to you for sharing an article like this. Vietnam Export Data

    ReplyDelete

Post a Comment

Popular posts from this blog

Get URL Parameter - server side script (portal or classic UI)

Classic UI : var sURL_editparam = gs . action . getGlideURI (). getMap (). get ( ' sysparm_aparameter ' ); if ( sURL_editparam == 'true' ) { gs . addInfoMessage ( 'parameter passed ); } Portal : var sURL_editparam = $sp . getParameter ( " sysparm_aparameter " ); if ( sURL_editparam == 'true' ) { gs . addInfoMessage ( 'parameter passed ); }

ServiceNow - script include: build up the results as a JSON object (array) - example 2

function call var sCurrentGroupMembers = new <script_include> (). getGroupMembers ( group_sysid ); gs . print ( 'sCurrentGroupMembers:' + sCurrentGroupMembers ); var oGroupMembers = JSON . parse ( sCurrentGroupMembers ); gs . print ( JSON . stringify ( oGroupMembers . users )); oNewGroupMember = JSON . parse ( group_members ); var oGroupConfig = getGroupDeltas ( oGroupMembers . users , oNewGroupMember ); gs . print ( JSON . stringify ( oGroupConfig . remove )); gs . print ( JSON . stringify ( oGroupConfig . add )) output : *** Script: sCurrentGroupMembers: {"manager":"3b2649efdb0f8c10cc0652f3f39xxxxx", "email":"", "type":"33a2226edb99c340edfc7cbdae96xxxx", "description":"Created for xyz", "users":[{"user":"3b2649efdb0f8c10cc0652f3f396xxxx"},{"user":"856a8f71db3d73041b4ffc45ae96196a"},{"user":"3752771