Perforce Integration Setup Using VBScript

The following instructions show how to set up a trigger script in Perforce which will notify FogBugz whenever a check-in occurs that is related to a particular bug. 

We provide sample scripts in both Perl and VBScript. This article describes using VBScript. If you would rather use Perl, see the alternate instructions here.

If you are a trial user, you can download the trial versions of these scripts by logging into FogBugz and clicking "Demo Source Control Integration" on the main menu.

1. Find the logBugDataP4.vbs script which is located in your FogBugz\Accessories\SourceControl\Perforce folder, and then place it in the directory that contains your Perforce server executable (e.g. C:\Program Files\Perforce\).

2. Edit the file as follows (Trial users: You only need to edit the P4USERNAME and P4PASSWORD variables.  The rest of this step is set up automatically for your trial server.):

3. Perforce will let you call an executable every time files are submitted (actually, just before the submission occurs). This is called a trigger. We want to use a trigger to call the logBugDataP4.vbs file every time any files are submitted in Perforce. Type p4 triggers on the command line (DOS window). A text file appears in Notepad. (If it doesn't, make sure the full path to p4.exe is in your Path environment variable.) To add the FogBugz trigger you need to add a line to at the bottom of this file.

The trigger looks slightly different depending on what version of Perforce you use:

Perforce Version 2003.2 - all triggers are of type "submit", no need to specify type:

FogBugzTrigger //... "cscript.exe C:\logBugDataP4.vbs %changelist% %serverport% %client%"

Perforce Version 2004.2 - you must specify the type of trigger as "submit":

FogBugzTrigger submit //... "cscript.exe C:\logBugDataP4.vbs %changelist% %serverport% %client%"

Note that this new line has a tab at the beginning. Also, adjust the file path to the logBugDataP4.vbs file to make sure it points to logBugDataP4.vbs on your server (wherever you put it).

Save this temp file and close Notepad. The trigger is now added. To see how to use this integration, click here for our screenshot tutorial.

If you don't see the checkin entries in the FogBugz case, here is some troubleshooting help: