- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Recently I have been getting a lot of questions and request about an old Knowledge presentation (concerning how we use views) to control a SOAP response. It may be best to blog it here and share.
First thing is first, lets create a special view on the incident table that only has number and short description and updated date. NOTE here: You want to create a view on the Incident Form if you are going to be getting an individual incident. There is a different list view when getting list. If you are getting list of incidents you would personalize the List Layout instead of the Form Layout in steps below.
Step 1: Open an Incident and Personalize Form Layout
Step 2: In the drop down section of the view select New (and give it a name).
Step 3: With your form view selected - pick the data you want in this view from the slush-bucket.
Step 4: Save (you now can see and select this view from the drop down on Incident)
At this point you can use this view in your URL get as well (using sysparam_view), but lets talk about SOAP request.
If you use a SOAP client like SOAPUI you can put the wsdl for the incident table we are using in this example
https://instance.service-now.com/incident.do?WSDL
If you look at the get request you will see this setup:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inc="http://www.service-now.com/incident">
<soapenv:Header/>
<soapenv:Body>
<inc:get>
<sys_id>04b28ae2c0a8016600c8f3d86e3278f4</sys_id>
<!--Optional:-->
<__use_view>chris</__use_view>
</inc:get>
</soapenv:Body>
</soapenv:Envelope>
Your response will look like this (notice the response is controlled by the view):
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<getResponse>
<number>INC0000066</number>
<short_description>Can't print legal document</short_description>
<sys_id>04b28ae2c0a8016600c8f3d86e3278f4</sys_id>
<sys_updated_on>2012-11-08 00:06:28</sys_updated_on>
</getResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Something important to note here is that this is data driven. You will not see the WSDL change when you create a new view, but since it is data driven you have the option of passing in the view of your choice and getting a more tailored SOAP response. Something else to note is that the sys_id is also included in your get response. You will automatically get this no matter what view you use (when calling get).
The same applies for getRecords as this test, except it will be looking for a List View (not a Form View) - so make sure you have both defined.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inc="http://www.service-now.com/incident">
<soapenv:Header/>
<soapenv:Body>
<inc:getRecords>
<!--Optional:-->
<active>?</active>
<!--Optional:-->
<activity_due>?</activity_due>
<!--Optional:-->
<approval>?</approval>
<!--Optional:-->
<approval_history>?</approval_history>
<!--Optional:-->
<approval_set>?</approval_set>
<!--Optional:-->
<assigned_to>?</assigned_to>
<!--Optional:-->
<assignment_group>?</assignment_group>
<!--Optional:-->
<business_duration>?</business_duration>
<!--Optional:-->
<business_stc>?</business_stc>
<!--Optional:-->
<calendar_duration>?</calendar_duration>
<!--Optional:-->
<calendar_stc>?</calendar_stc>
<!--Optional:-->
<caller_id>?</caller_id>
<!--Optional:-->
<category>?</category>
<!--Optional:-->
<caused_by>?</caused_by>
<!--Optional:-->
<child_incidents>?</child_incidents>
<!--Optional:-->
<close_code>?</close_code>
<!--Optional:-->
<close_notes>?</close_notes>
<!--Optional:-->
<closed_at>?</closed_at>
<!--Optional:-->
<closed_by>?</closed_by>
<!--Optional:-->
<cmdb_ci>?</cmdb_ci>
<!--Optional:-->
<comments>?</comments>
<!--Optional:-->
<comments_and_work_notes>?</comments_and_work_notes>
<!--Optional:-->
<company>?</company>
<!--Optional:-->
<contact_type>?</contact_type>
<!--Optional:-->
<correlation_display>?</correlation_display>
<!--Optional:-->
<correlation_id>?</correlation_id>
<!--Optional:-->
<delivery_plan>?</delivery_plan>
<!--Optional:-->
<delivery_task>?</delivery_task>
<!--Optional:-->
<description>?</description>
<!--Optional:-->
<due_date>?</due_date>
<!--Optional:-->
<escalation>?</escalation>
<!--Optional:-->
<expected_start>?</expected_start>
<!--Optional:-->
<follow_up>?</follow_up>
<!--Optional:-->
<group_list>?</group_list>
<!--Optional:-->
<impact>?</impact>
<!--Optional:-->
<incident_state>?</incident_state>
<!--Optional:-->
<knowledge>?</knowledge>
<!--Optional:-->
<location>?</location>
<!--Optional:-->
<made_sla>?</made_sla>
<!--Optional:-->
<notify>?</notify>
<!--Optional:-->
<number>?</number>
<!--Optional:-->
<opened_at>?</opened_at>
<!--Optional:-->
<opened_by>?</opened_by>
<!--Optional:-->
<order>?</order>
<!--Optional:-->
<parent>?</parent>
<!--Optional:-->
<parent_incident>?</parent_incident>
<!--Optional:-->
<priority>?</priority>
<!--Optional:-->
<problem_id>?</problem_id>
<!--Optional:-->
<reassignment_count>?</reassignment_count>
<!--Optional:-->
<reopen_count>?</reopen_count>
<!--Optional:-->
<resolved_at>?</resolved_at>
<!--Optional:-->
<resolved_by>?</resolved_by>
<!--Optional:-->
<rfc>?</rfc>
<!--Optional:-->
<severity>?</severity>
<!--Optional:-->
<short_description>?</short_description>
<!--Optional:-->
<sla_due>?</sla_due>
<!--Optional:-->
<state>?</state>
<!--Optional:-->
<subcategory>?</subcategory>
<!--Optional:-->
<sys_class_name>?</sys_class_name>
<!--Optional:-->
<sys_created_by>?</sys_created_by>
<!--Optional:-->
<sys_created_on>?</sys_created_on>
<!--Optional:-->
<sys_domain>?</sys_domain>
<!--Optional:-->
<sys_id>?</sys_id>
<!--Optional:-->
<sys_mod_count>?</sys_mod_count>
<!--Optional:-->
<sys_updated_by>?</sys_updated_by>
<!--Optional:-->
<sys_updated_on>?</sys_updated_on>
<!--Optional:-->
<time_worked>?</time_worked>
<!--Optional:-->
<upon_approval>?</upon_approval>
<!--Optional:-->
<upon_reject>?</upon_reject>
<!--Optional:-->
<urgency>?</urgency>
<!--Optional:-->
<user_input>?</user_input>
<!--Optional:-->
<watch_list>?</watch_list>
<!--Optional:-->
<work_end>?</work_end>
<!--Optional:-->
<work_notes>?</work_notes>
<!--Optional:-->
<work_notes_list>?</work_notes_list>
<!--Optional:-->
<work_start>?</work_start>
<!--Optional:-->
<__use_view>?</__use_view>
<!--Optional:-->
<__encoded_query>?</__encoded_query>
<!--Optional:-->
<__limit>?</__limit>
<!--Optional:-->
<__first_row>?</__first_row>
<!--Optional:-->
<__last_row>?</__last_row>
<!--Optional:-->
<__order_by>?</__order_by>
<!--Optional:-->
<__order_by_desc>?</__order_by_desc>
<!--Optional:-->
<__exclude_columns>?</__exclude_columns>
</inc:getRecords>
</soapenv:Body>
</soapenv:Envelope>
Cheers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.