User Tools

Site Tools


common_request_format

Common Request Format

Version Author
Argon pnguyen

The following is the default implementation of the common request format. The common request format mirrors what one would see of the Request form in ServiceNow with related lists expressed in embedded XML form. The Common Request update set will include a Table Map that generates the below XML payload when specified in a Dynamic Share, it also includes the default Import Set Table and Transform Maps to ingest this format and produce all the artifacts that comprises of a Request and its related records.

Implementation

The implementation of any common document format is symmetrical which means that the output, when consumed, should produce the same or similar records at the target. The implementation should also exhibit idempotent behavior which means that when the same document is consumed and processed repeatedly, the same result appears or is ignored because the results already exists.

Dynamic Shares

For the correct outputs to be produced, you must create 2 Dynamic Shares - one to capture the comments and work_notes field values in a before context, and the other as async mode to capture the related records in a delayed step.

In the before Dynamic Share, use the following code snippet to prevent unwanted outbound messages to be queued when comments or work_notes are not updated.

if (current.comments.nil() && current.work_notes.nil()) {
	ignore = true;
}

Outbound Table Maps

The following table maps construct the outbound messages to be queued. Specify the main Request to Common Request Table Map in your Dynamic Share as the root map.

Name Type Source table Description
Request to Common Request common_request Request [sc_request] Main body of the common_request format
psp_attachment embedded_attachment sys_attachment Map for building embedded attachments field
psp_requested_item embedded_requested_item Requested Item [sc_req_item] Map for building embedded requested items
psp_approver embedded_approver Approval [sysapproval_approver] Map for building embedded approvers
psp_group_approval embedded_group_approval Group approval [sysapproval_group] Map for building embedded group approvals
psp_recurring_price embedded_recurring_price Recurring Price [sc_recurring_rollup] Map for building embedded recurring prices

NOTE: As of the Fluorine release, the Catalog Task (sc_task) table map is included as part of the Common Request update set. To learn more about catalog tasks, see view and edit a catalog task.

Inbound table Map

In order to process messages of topic: siam and type: common_request, you must create an inbound table map to target the import set table as follows. (This map should have been included in the provided update set already)

Import Set

The import set table is called u_psp_common_request and has a transform map called PSP Common Request to Request. This transform map has transform scripts that are responsible for parsing the embedded sections of common_request:

  • attachments
  • requested_items
  • approvers
  • group_approvals
  • recurring_prices

Select to deactivate each of these transform scripts if you choose not to parse these embedded objects into records. If you need to extend or add additional capabilities, instead of modifying the existing scripts, add new ones so that upgrades are possible.

These transform scripts use specific script includes to assist in parsing and ingesting the embedded objects into the correct artifacts. The script includes are

  • PerspectiumAttachment
  • PerspectiumRequestedItem
  • PerspectiumApprover
  • PerspectiumGroupApproval
  • PerspectiumRecurringPrice

These script includes are included as part of the Common Endpoint update set that should be installed prior to installing the common object format update sets.

Attachments

Attachments are automatically embedded inside the Common Document Format record that is shared and subscribed to by MSPs and Customer Endpoints. This is done using embedded table maps that are included with the Common Endpoint update set. Attachments are limited to 7MB in size per outgoing Common Document Format record.

To ensure that duplicate attachments are not sent out in an incident, a “tag” should be created so as to tag attachments. This way, when a record is updated and attachments are queried for that record to embed, it will ignore attachments that have been sent and are “tagged”.

To setup a tag:

  1. Create a tag in the “label” table (type “label.list” in the Filter Navigator box to quickly go to the label table):

  1. Use a unique name such as “msp_client_sent” or “msp_client_request_sent” to ensure this tag is not used by other MSP or SIAM integrations. If you create the tag as “msp_client_request_sent”, you can skip the next step and are done setting up a tag. NOTE: If you are integrating multiple common document formats, use a different tag for each format (i.e. “msp_client_incident_sent” for incident, “msp_client_problem_sent” for problem, etc.)
  2. Go to the Perspectium > Control and Configuration > Table Maps and open the “Request to Common Request” outbound table map
  3. Open the field map that begins with “${TM:psp_attachment”:
  4. In this field map, replace “msp_client_request_sent” with the name of the tag you created in step one:
  5. Go to the Import Set table (type in “u_psp_common_request.list” in the Filter Navigator box) and click on the “Transform maps” UI action
  6. Open the “PSP Common Request to Request” table transform map and then go to the “Transform Scripts” section
  7. Open up the attachment transform script and change “msp_client_request_sent” to the tag created in step one. Note, keep the “” around the tag when you replace it here. For example, if your tag is named mycompany_sent, change “msp_client_request_sent” to “mycompanysent”:

Sample Output

<?xml version="1.0" encoding="UTF-8"?>
<common_request>
	<active>1</active>
	<activity_due />
	<additional_assignee_list />
	<approval>not requested</approval>
	<approval_history />
	<approval_set />
	<approvers />
	<assigned_to />
	<assignment_group />
	<attachments>
		<attachment>
			<data>iVBORw0KGgoAAAANSUhEUgAAAK8AAABBCAMAAACQAg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SK05gQXUwrlZr5OawDNawnZN3m+INpT9EJ1yhMoeyrC3y17PTKTevdhcwPtwE3ItZ+oA7VXzHXo2GeTToDr8aX9X3wZLWAV2Jt/TQm2LlKN58+XtTatHcFRz3y/k7tVCwEWh9ALIXGvPHHdwfzweoD9Kc1QdLwVfAsySMaPVKrooxLussT1V/B544COtu9+j6q25Z/bUKigUXGlYUWnmFR5bL0FzSvu1k59tEhLONnHHGxx+Tcb7pi/h8UyxaETDCW/iUNYsuutro+pL2bWfOh37L/Yy3vrLCvF0GUf+AacEl4AjTBuiXhWnL/v4qaBpt1L7Xn9Xi/swxaG9GMsWN1kPWuJ7daX3CS/qzBu3PZnv9mbTF4bm3bPRAjeBZ85/ebrU7/M3+t5j0vxPa+5KnjchDkrvvGYbhtT7mjfrfTbDX/25WCn5MvdjTX57127V2pz38kTd7vijJ8Xxhu3S2IAW5H68n05HtOa4hH/Km5gsYJ3bnC/Kzh7uNSV2QNuL+QcqRD1nzm0yJ2HXHBboOZKydzG/9jtFvecYhbzK/zWHbp+Y3nzrQU7SgXtf9+8q9JqmbHPstMx8uzNR8TArYRLgWd/NB7HpEh/mbno+p92A+RokDPAgjVMlRz7LeP5Tbbvz+waxBEB3IVNc0U+8fuh3jg/rw5/cPSlrM/rnz7evivJyX83Le3LwHg8HJeM/z/7fimXSu/29ycXFxcXFx/YD+A/kcro9vgcpQAAAAAElFTkSuQmCC
			</data>
			<size_bytes>1407</size_bytes>
			<file_name>db2.png</file_name>
			<sys_id>3775ab304f510300d8f453418110c761</sys_id>
			<content_type>image/png</content_type>
		</attachment>
	</attachments>
	<business_duration />
	<business_service />
	<calendar_duration />
	<calendar_stc />
	<closed_at />
	<closed_by />
	<close_notes />
	<cmdb_ci />
	<comments />
	<comments_and_work_notes />
	<company />
	<contact_type />
	<correlation_display />
	<correlation_id />
	<delivery_address />
	<delivery_plan />
	<delivery_task />
	<description />
	<due_date>2017-10-06 03:09:59</due_date>
	<escalation>0</escalation>
	<expected_start />
	<follow_up />
	<group_approvals />
	<group_list />
	<impact>3</impact>
	<knowledge>0</knowledge>
	<location />
	<made_sla>1</made_sla>
	<number>REQ0010002</number>
	<opened_at>2017-10-04 03:10:00</opened_at>
	<opened_by>6816f79cc0a8016401c5a33be04be441</opened_by>
	<order />
	<parent />
	<price>450</price>
	<priority>4</priority>
	<provider>servicenow</provider>
	<reassignment_count>0</reassignment_count>
	<recurring_prices>
		<recurring_price>
			<recurring_frequency>monthly</recurring_frequency>
			<recurring_price>50</recurring_price>
		</recurring_price>
	</recurring_prices>
	<rejection_goto />
	<requested_date />
	<requested_for>6816f79cc0a8016401c5a33be04be441</requested_for>
	<requested_items>
		<requested_item>
			<price>450</price>
			<stage>waiting_for_approval</stage>
			<quantity>1</quantity>
			<assigned_to />
			<due_date>2017-10-06 03:09:59</due_date>
			<cat_item>bd6fa75a4f334200086eeed18110c79e</cat_item>
			<number>RITM0010002</number>
			<sc_catalog />
		</requested_item>
	</requested_items>
	<request_state>requested</request_state>
	<short_description />
	<sla_due />
	<special_instructions />
	<stage>requested</stage>
	<state>1</state>
	<sys_class_name>sc_request</sys_class_name>
	<sys_created_by>admin</sys_created_by>
	<sys_created_on>2017-10-04 03:10:00</sys_created_on>
	<sys_domain>global</sys_domain>
	<sys_domain_path />
	<sys_mod_count>0</sys_mod_count>
	<sys_tags />
	<sys_updated_by>admin</sys_updated_by>
	<sys_updated_on>2017-10-04 03:10:00</sys_updated_on>
	<time_worked />
	<upon_approval>proceed</upon_approval>
	<upon_reject>cancel</upon_reject>
	<urgency>3</urgency>
	<user_input />
	<variables />
	<variables />
	<variables />
	<watch_list />
	<wf_activity />
	<work_end />
	<work_notes />
	<work_notes_list />
	<work_start />
</common_request>

The following Perspectium Inbound/Outbound Message unloads can be un-gzipped and uploaded into your instance of ServiceNow to view and used for testing.

Common Request Sample - Inbound.xml.zip

Common Request Sample - Outbound.xml.zip

common_request_format.txt · Last modified: 2019/02/13 22:59 by timothy.pike