+44 07967 557183

VSTS to FogBugz Automation

Introduction

I needed to automatically update a FogBugz Case based upon actions within Visual Studio Team Services (VSTS) work items. To achieve this I am using Zapier and the FogBugz API.

VSTS Work Items

We have items in the HelpDesk area of VSTS and when we move items to the “Deployable” Column of the Kanban board we would like to resolve the FogBugz Case associated with it. vsts_work

Zapier Integration

In Zapier, I have setup a new Zap (Workflow process). The steps of the Zap are as follows. zapier_steps

Step 1 - Update Work Item

Using the Zapier VSTS integration, I added our Automation User Account in order to access VSTS. Setup the action to “Update Work Item”. This will make Zapier monitor VSTS for actions on work items. This will make Zapier monitor VSTS for actions on work items in the areas specified below. zapier_vsts

Step 2 - Only continue if…

Because there are multiple columns on the board and I am only interested in when a work item is placed in the Deployable column, I have created a Zapier filter to query for that condition. zapier_if

Step 3 - Custom WebHook

Now that we have successfully monitored and picked up the actions from VSTS Kanban board, I now need to find the FogBugz case which references the VSTS Work Item. Using a custom Webhook in Zapier I can query the FogBugz JSON API for the FogBugz Case number, using the VSTS Work Item Number Ref (custom) field. You can see in the below image I am POSTing to FogBugz API endpoint a JSON formatted query, utilising the Work Item number we collected in Step 1 from the action on Kanban board.  zapier_fogbugz_json

Step 4 - Post to FogBugz to Resolve Case

After the above step completed successfully I should now have the FogBugz case number in question, this will allow me to POST another command to the API to resolve the Case. You can see in the below image I am POSTing to FogBugz API endpoint a query, utilising the Work Item number we collected in Step 3 This uses the API cmd resolve. zapier_resolve_case

Seeing it all in action

Right so now i have put all the pieces together. In FogBugz I have the following two cases open assigned to me, with the VSTS Ref field filled in. [gallery ids=“214,216” type=“rectangular”]   In VSTS we have the work items that match these cases vsts_work Now if I move the case into the Deployable Column, Zapier will pick up the action and resolve the case. vsts_complete Check Zapier History. There are two successful tasks ran. zapier_history If i expand the tasks, you can see each action. zapier_task_success Lets check FogBugz now. fogbugz_resolved And both cases are now marked as Resolved.