Today's post was written by William Dibbern, Principal Developer at Sonoma Partners.
Let's do just that and take a look at a tool called Imposter.
Imposter is an extension to the widely popular Fiddler which allows you to serve up files from your local file system in response to requests from your browser.
The way Imposter works is that it hooks into Fiddler's API to see when the browser requests a web resource from the Dynamics CRM, and it uses some simple logic to figure out which file on your local system it should send in place of whatever the server has.
This has two advantages:
If you're familiar with Fiddler, you may be familiar with its AutoResponder functionality and therefore may be wondering what the advantage of Imposter is over this built-in functionality. Here are a few key points:
Once you've got Fiddler and Imposter for Fiddler installed, you'll see a new icon in your menubar. If you click it, you'll see several options. Let's start with adding a profile first.
Since we're working in CRM, we can just enter /WebResources/publisherprefix_/ (where "publisherprefix" is the prefix you've chosen in your solution, by default "new") and what Imposter will do is wait for any request that contains /WebResources/publisherprefix_/ in the URL, and it will attempt to parse a file name from that string.
So let’s say your browser requests a webpage at https://crm.organization.com/WebResources/publisherprefix_/CustomSearch/index.html?data=awesome, Imposter will see the /WebResources/publisherprefix_/ segment of that URL and will start looking for a file in the CustomSearch folder called index.html. If found, Imposter will serve that file up in place of what the server has.
Now that we've got a profile created, we can start things up.
I bet you noticed the Auto Reload option in the Imposter menu, didn't you? Wondering what that is? When Auto Reload is enabled, Imposter will monitor the Local Directory in any enabled profile(s) and wait for changes. If it detects a change, any HTML web resource that was already swapped out by Imposter will automatically refresh itself to account for the newest updates. Awesome, right?
I would recommend using caution with this feature, though. If you swap out an HTML web resource hosted in an iframe, any event handlers attached to functions in that iframe could be broken when it refreshes, making the utility a little less useful. For that reason, I primarily use this feature for dialogs and fully custom pages.
All this talking and no links to download? Well here ya go: Imposter for Fiddler on GitHub. The tool is hosted on GitHub, so if you'd like to submit a feature request or any other changes, feel free! There is also a Wiki on the GitHub repository which has some great tips and tricks for using Imposter. Enjoy!