October 27, 2008
Simple Create Defect Button in SugarCRM
Works with TestTrack 2008
Works with SugarCRM 5.1
This article includes the steps to add a simple Create Defect button to your SugarCRM interface, which will automatically generate a defect in TestTrack.
OverviewThis integration requires that you modify core files in the Cases module of your SugarCRM installation. Doing so incorrectly can render SugarCRM unusable, which will almost certainly upset a lot of the people you work with. Please be careful!You'll need:
- Your TestTrack Web server to be accessible from the SugarCRM deployment.
- The path to your TestTrack Web server installation. If you're familiar with how web servers work and your IT environment, you can probably guess this. If not, ask the TestTrack administrator or IT staff for help.
- A valid TestTrack projed id. This can be obtained from the TestTrack Admin Utility, or by contacting your TestTrack administrator.
- Necessary permissions & knowledge to customize the back-end source code.
- A Create Defect button on the Case Detail screen. When clicked, a new defect will be created in TestTrack, populated with information from the case in SugarCRM.
- Add a custom button to the Detail view.
- Associate the button with a custom script we're going to write.
- Hook the script into your TestTrack Web interface.
DownloadThe download contains the source files needed for this sample integration. Download the Create Defect Button Source zip file.
- CreateTTDefect.php - Custom script that handled creating the defect in TTP, called when the custom button is clicked.
- detailviewdefs.php - SugarCRM core source code that defines the Cases Detail view. This is where the button code goes.
- detailviewdefs.php (DIFF) - Diff file of changes made between default SugarCRM CE v5.1.0a (Build 4837).
- en_us.lang.php - Language file, with button labels.
- en_us.lang.php (DIFF) - Diff file of changes made between default SugarCRM CE v5.1.0a (Build 4837).
Add the ButtonThe first order of business is to add a button to the Case Detail view. This is the dangerous part, where you copy the downloaded code into your SugarCRM installation.
- Browse to your SugarCRM installation directory.
- Go to ...modulesCases directory.
- Copy CreateTTDefect.php into this directory.
- Make the necessary changes to detailviewdefs.php in the metadata sub-directory.
- Make the necessary changes to en_us.lang.php in the language sub-directory.
Update CreateTTDefectNext up, we need to make a couple minor changes to the defect creation script.
- Line 7 - Update yourserver with the location of your SugarCRM installation.
- Line 13/14 - Update the user/pwd to a SugarCRM account with permissions to login through Soap and pull Case data.
- Line 40 - Update yourserver/cgi-bin with the location of your TTP web installation.
- Line 40 - Update databaseid=?? with the id of the TTP project you want to insert data to.
- This project must have SoloSubmit access enabled.
Try it Out!The only thing left to do is try it out.
- Log into your SugarCRM account.
- Open the Cases module.
- Open a case, and you should see a new button, titled Escalate.