Accelerate CRM web resources development using Fiddler

While developing web resources for Dynamics CRM, it is always a bit of pain to keep publish and test the changes. No matter how much-automated deployment you are talking about but those few minutes of publishing the solution breaks the flow of development for a “developer”.

Here is a cool tip, using FIDDLER’s “Auto Responder” to use the local file throughout the development period. All you have to do is,

  • publish your web resource once for the first time
  • keep working/developing the web resource and save the file in local
  • go into CRM and refresh the page. You will see your changes live 😊.

Just in case if you haven’t heard about Fiddler – it’s a free web debugging tool which logs all the HTTP (S) traffic happening from your computer. More Info and download available @ https://www.telerik.com/fiddler

Let’s look at how to do this with Fiddler. As mentioned above, we have to first create the Web resource and deploy it for the first time. I’m sure every CRM Developer here knows how to create a web resource and so I’m not detailing it over here rather – here is a screenshot of my web resource which is attached to a Contact’s onload and the result as well.

Note: The code below is just to show the concept, don’t bother about the standards of it…

image003

image008

You can see that, I just started my code and I’m still developing it. The first thing I will do is deploy this as a web resource in CRM. And start FIDDLER. (It is expected that by now, you have your fiddler downloaded and installed) . Here are the series of steps to follow.

  1. Start Fiddler and refresh your CRM page. That should display all the HTTP traffic happening in your machine as shown below.

  1. From the list check for your web resource file. (Follow the image for a quick tip on how to find your file)

  1. Now, Click on the AutoResponder tab and Select “Enable Rules” and “Unmatched requests passthrough”. Click Add Rules.

  1. The moment you click on Add Rule, Fiddler will automatically create a new Rule with the web resource selected in step 1.

  1. If you observe the rule it says “EXACT” match. Although this would work for now, but may not work all the times because some parts of URL keep changing based on your refresh (like the ver=3421.. in the above screenshot). So my preferred way of doing it is, to get rid of all the unnecessary parts of the URL and keep the main web resource name (which in the ideal case should be unique for you). Here is a quick screenshot.

  1. This is the key step. From the drop-down below the URL in RuleEdtor, Select the option “Find a File” and choose your Javascript file from your local machine.

  1. Click on Save and your Fiddler’s AutoResponder rules should look like

3

  1. That’s it; You are all set to go. All you have to do is, Change the content of your JS file and refresh your CRM Page. Your CRM Page will send a request for the JS web resource. But Fiddler intercepts it and instead of sending the request to CRM, it simply returns your local file as response. (unfortunately, I can’t show this with simple screenshots, but you should be able to get it when you try it )

image031

image032

In my opinion, it helps a lot to the developers in quickly testing their web resources. Especially when working on a bigger modules/html web resources etc. The way I will deal with these kinds of web resources is, complete all the development work like this and once satisfied with the result then deploy the changes to the web resource, publish and do a final round of test.

Hope this helps you as well, share your thoughts/comments.

Happy coding !!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s