---
title: "ServiceNow <> Rally Integration (Legacy)"
canonical: "https://docs.perspectium.com/space/earlierReleases/1442156/ServiceNow%20%3C%3E%20Rally%20Integration%20(Legacy)"
format: markdown
---
This integration  allows for replication of ServiceNow Incidents, Problems, and Demand to Rally Defects, Features, and User Stories.  This is a legacy feature so it has restricted permissions for Perspectium employees only - it is intended for internal use with customers on a need-by-need basis.  Rally Installation + Configuration Adding Custom Fields Defects The Defects field only needs one custom field for   ExternalID   like this: User Stories and Features Integration for Rally User Stories and Features need the following custom fields to be created:   ExternalID ,   Priority ,   Assigned To ,   ServiceNowID , and   Opened By . To create these fields, click  Settings  in the top right corner. Then select the  Workspace and Projects  option on the top menu, and then click your desired workspace. Click the   Projects   option on the far left menu to view a list of all your projects. Select your desired project and click the   Fields   option on the far left menu to view a list of all the fields in that project. Then, use the dropdown to select type User Story or Feature and click  New Field . Note for fields like   Assigned To   and   Opened By   the   Name   needs to use an underscore for the space. For example: For the   Priority ,   the configuration should be a Drop Down List with the options “1”, “2, “3” and “4” like this: Create a Dedicated Perspectium User Click  Settings  in the top right corner. Then click  + Add New . Make a dedicated Perspectium Integration user with Workspace Administrator permissions. This user should not be a user account that a person would use to interactively log into Rally through the browser and create or update records. Create an API Key Create an API   key, which you can create   here . ServiceNow Installation and Configuration MBS Provisioning  As part of provisioning MBS for this integration, Perspectium will work with you to configure mappings between our Common Documents and Rally's different issue types. That is, we will work with you to map fields so the proper values from ServiceNow map to the appropriate fields and values in Rally, using our default mappings as a starting point. Please contact   support@perspectium.com   for more information. Update Sets To begin integrating SIAM for Rally into your ServiceNow instance, you must first install the Perspectium update sets - request the download links from   support@perspectium.com .  The update sets should be installed in this order: Perspectium for ServiceNow update set Perspectium Common Endpoint Perspectium Common Doc to integrate (ie. Common Incident, Common Change, etc.) Perspectium SIAM for Rally update set Once both update sets have been installed the Perspectium app in the ServiceNow menu will show the Rally SIAM Integration tab: Shared Queue In order for ServiceNow to communicate with Rally properly through MBS, create a   shared queue   with the name   psp.in.siam.client.rally . Enter the  Endpoint URL ,  Queue User Password  and  Queue User  (Queue user should be in the format  <vhost>/<username> ) as has been provisioned and provided by Perspectium. Once the shared queue has been created, select the  Shared Queue  module under the  Rally SIAM Integration  tab to see this queue and its configuration. NOTE:  You must create and configure this shared queue before moving on to the   Creating a Webhook   step. Creating a Webhook Select the   Configuration   module under the  Rally Siam Integration  tab. Create a new record to see a form like this: Fill out the fields as such: Add a Name which will be used to name the Rally Webhook. This can be anything you would like. Add the Integration User from the previous Rally Configuration section. Add the Integration Password from the previous Rally Configuration section. The Project dropdown list will be empty the first time you configure a webhook so click  Submit Now click on the newly created record to edit, and select  Reload Projects Choose your project from the dropdown and click  Update Click  Create Webhook Table Maps The Common Document update set you install will include both an inbound table map and an outbound   table map. The inbound table map can be left as is since it is used to subscribe incoming Common Document records to the import set table that will be used to transform Common Document records into the ServiceNow table used for this integration (such as the incident table). The outbound table map is used to map fields from the source ServiceNow table (such as incident) to the Common Document. This table map should be configured to map the fields and work with the mappings done on MBS. Please contact   support@perspectium.com   for more information on setting up field mappings. You can create a   copy   of the outbound table map included with the Common Document update set if you want to keep the original version as a reference. Dynamic Shares Create a   dynamic share   for the table you want to integrate with Rally (for example, the incident table). Use the previously created  psp.in.siam.client.rally  as the target queue and use the previously created outbound table map as the dynamic share's table map. Incident To properly send out messages with the correct action type (i.e. insert, update, etc.) when integrating ServiceNow incidents with Rally defects, use the following script in the dynamic share's Before Share Script: if(!gs.isInteractive() && psp_action != "ack_provider_incident"){
    ignore=true;
}
else if(psp_action == "update" && !current.correlation_id.hasValue()){
    psp_action = "insert";
}
else if(psp_action == "ack_provider_incident"){
    psp_action = "update";
}
else if(current.state.isChangingTo("resolved")){
    psp_action = "resolved";
}
else if(current.state.isChangingTo("closed")){
    psp_action = "closed";
} Other tables can have a similar script as above if needed to properly correlate records in Rally. It is also imperative to set your  Business Rule When  to  before  in order to properly send out messages. Transform Maps The Common Document update set will include an import set table and a transform map to transform the incoming Common Document into the ServiceNow table. For example, if integrating ServiceNow incidents with Rally defects, the PSP Common Incident import set table ( u_psp_common_incident ) will allow you to transform Common Incident records into the ServiceNow incident table. Field Maps To properly coalesce records between ServiceNow and Rally using the ServiceNow's number field and storing Rally's ID in ServiceNow, field maps in the included transform map should be configured as follows: Source Field Target Field Coalesce u_number number false u_correlation_id correlation_id false u_correlation_display correlation_display false As well, a field map that uses script should be created to properly find the record in ServiceNow if it already exists:   var gr = new GlideRecord('incident');	
	var qc = gr.addQuery('correlation_id', source.u_correlation_id);
	qc.addOrCondition('number', source.u_number);
	gr.query();
	if (gr.next()) {
		return gr.sys_id;
	}
	
	return -1; // no return found, return -1 to create a new record This field map accounts for records created in Rally so as to create a new record. As well, for the cases where a record is created in Rally first and you want to send back to it the ServiceNow record's number field, create an onAfter transform script in the import set's transform map with the following:   if(source.u_action == "insert"){
	var pRally = new PerspectiumRally();
	pRally.acknowledgeProviderIncident(target);
} This will share out a record with the record's ID so that Rally can receive and update it to have the ServiceNow ID as a correlation ID. ServiceNow <> Rally Attachments NOTE:  Rally Attachments are currently only supported for ServiceNow Incidents to Rally Defects In the dynamic share that you created earlier, go to the  Additional Settings  tab and uncheck the  Include Attachments  box. Then, go to your Table Map and Create (or edit if already exists) the following field. Field Value A. Source Field ${TM:psp_attachment;table_sys_id=$[GR:sys_id];rally_sent} B. Target Field attachments C. Field Type leave blank D. Field Length leave blank E. Use Script unchecked F. Add CDATA Tags unchecked NOTE:  Assure that Field Type and Filed Length are left blank after the mapping field has been created.