September 5, 2007

Synchronizing TestTrack and Salesforce.com

Integration

Works with TestTrack 2008 and later

Will not work with TestTrack 7.6 and earlier

This sample uses a TestTrack trigger to synchronize defect changes with cases in Salesforce.com.

You'll need:

  • An existing Salesforce.com account and the necessary permissions to create case custom fields and access the SDK.
  • Permissions within your TestTrack project to create executable triggers.

You'll get:

  • An automated TestTrack trigger that synchronizes defect changes with associated cases in Salesforce.com.

Download

The download contains the source files and binaries needed to synchronize data between TestTrack and Salesforce.com. Download the SyncToSFDCCase zip file.

  • SyncToCase.exe - Executable built with C# .Net and Visual Studio 2005. This script handles synchronizing defect changes with associated cases in Salesforce.com.
  • SyncToCase.bat - Batch file that acts an intermediary between the TestTrack trigger and the SyncToCase.exe.
  • Source Code - Visual Studio 2005 solution and all required source code to build the SyncToCase.exe. You only need this if you want to make changes to the script. If you follow the steps in this article, the included .exe will work just fine.

Create TestTrack Trigger

You need to create a trigger in your TestTrack project to call the SyncToCase.bat you just downloaded.

  1. Login to your TestTrack project.
  2. Choose Tools > Administration > Automation Rules. Click the Triggers tab.
  3. Click Add to create a new trigger. Enter a trigger name, such as Salesforce.com Sync.
  4. Click the Trigger When tab, select After Save then Defect is changed. This creates a trigger that executes after any defect changed is saved.
  5. Click the Actions tab, click Add and select Run executable from the list.
  6. Enter the path to the SyncToCase.bat you downloaded, being sure to wrap the path in quotes if it contains spaces.
You're all setup in TestTrack. Now you need to edit the SyncToCase.bat to call the SyncToCase.exe with the necessary parameters. When calling SyncToCase.exe, you need to pass your Salesforce.com username and password in plain text. For example, C:SyncToCase.exe msharp@nospam mypassword

Customize Salesforce.com

This step is optional. If you want to use the sample as it is then you'll need to create some custom fields in Salesforce.com to store the TestTrack defect information. Alternatively, you can modify the code to do whatever you want, then rebuild the exe and go that route.

Creating custom Salesforce.com fields

  1. To create custom fields in your Salesforce.com account, choose Setup > App Setup > Customize > Cases > Fields.
  2. Create the following fields.
  • Defect Number - to store the TestTrack defect's number with the case in Salesforce.com. Create a field with Field Name TestTrack_Id, API Name TestTrack_Id (Salesforce adds the __c to the field name for custom fields you type, so the API name with which you refer to it will end in __c, and become TestTrack_Id__c.
  • Status - to store the TestTrack defect status with the case in Salesforce.com. Create a field with Field Name TestTrack_Status, API Name TestTrack_Status. Again, the API name is entered as the same in Salesforce, although the API will know it as TestTrack_Status__c.
  • Currently Assigned To - to store the TestTrack defect current assignments with the case in Salesforce.com. Create a field with Field Name TestTrack_Assigned, API Name TestTrack_Assigned.

Try It

The only thing left to do is to manually associate a defect in TestTrack with a case in Salesforce.com. Lookup a case number in your Salesforce.com account, and enter that into the Reference field of a defect in your TestTrack project. Save the defect, and that should activate the trigger we created. Refresh your Salesforce.com view, and you should see the three new custom fields populated with relevant data from the defect in TestTrack. To make this even better, hook up another example I wrote that lets you create defects in TestTrack from your Salesforce.com account. Using both examples, you can have a fully automated way for your Support team to escalate cases to Development and be kept up-to-date on Development's progress without ever leaving their Salesforce.com account.

Tech Details and Notes

This sample was written against the Salesforce.com Partner WSDL, which is a more generic way to access their API. The great thing is it works against any Salesforce.com account, so anyone can download this sample and use it as-is. If you're going to modify this for your own Salesforce.com account, using the Enterprise WSDL would be easier since it creates all of the complex objects for you. The downside is that it's specific to your account so you have to regenerate the stubs anytime you add fields or objects to your account, and want access to those via the API. Probably easier than coding to a generic API, but just something to keep in mind. Note: Seapine does not provide support for sample triggers.