Category Archives: CRM 2011

Using Telerik’s Fiddler to work with Microsoft Dynamics CRM

5-19-2015 1-51-56 PMWhat? You don’t have Fiddler?

My friend, you’re missing out, big time. Okay, let me help. First go here to the Telerik website and download the latest version. It’s free. I’ll wait here until you install it.

Got it? Okay, then let’s talk about it.

You might be wondering what my fuss is all about. You might also be wondering if this is some sort of paid advert, but I can assure you, I’m not related to Telerik in other way than as a customer. Turns out that Fiddler is one of the best tools you’ll find for debugging your CRM customizations.

This is how it works: In simple terms, when it’s active Fiddler intercepts every single web traffic call that is made from or to your computer to any other server, be it in the Internet or inside your company network. Not only does it catch all this traffic, it also presents the traffic in great detail.

This won’t be a full Fiddler tutorial, but I will list some ways you can use Fiddler in your CRM debug work. Also, I won’t show screenshots because I work at a financial institution and there’s a very slight possibility that some information might be decoded from any URLs I show here.

Reload an entity form

You know that with CRM 2013 and 2015, if you press F5 while debugging a page, you’ll go back in your form history to wherever you started. This is pretty bad when you’re using something like the IE Developer Tools script debugger, because you need to navigate all the way into the entity form you’re debugging, and then set up your break points again.

What Fiddler allows you to catch is the actual URL of the form being worked on. You can get this URL by clicking on the appropriate entry on the web traffic list (you’ll know what I’m referring to when you see it), select Inspectors from the upper-right area (the request area), and then select Raw view. Now you can happily copy this address, paste it into the browser, and press F5 to your heart’s content.

Missing web resources

Your form is not working properly and you have no idea why. Maybe you have a web resource that references another JavaScript library and it’s not finding it? Or some images are not loading? What could it be? Well, just by looking at the traffic, we can see any calls that are marked in red. Those calls have failed, and now we can use the inspector view for the request to verify if we have the correct path, although you could also do this in the timeline itself.

Failed service calls

You create your pretty request for the Organization Service to bring in some data and you get nothing. Hmm. Well, looking at in in Fiddler you can find out if the call itself has the correct syntax, and if so, you can look at the response with the JSON formatter and figure out if you actually got something back. Also works in the same manner with your on WCF services. Pretty handy, huh?

Performance evaluation

You can select however many rows from the traffic list and then switch the the Timeline graph showing the time spent on each call. This helped us a lot when fine-tuning the performance of our CRM implementation.

System element addresses

You want to use a certain CRM graphic (like a “Loading” GIF), but don’t know where it is? With a bit of trial and error you can find out the exact location of that resource, and then use it in your own web resources.

Are you still thinking about it?

As you can see, Fiddler is an excellent weapon in the arsenal of the well-prepared CRM developer. It helps us deal with some of the quirks we find when debugging CRM customizations, and even can help us figure out how Microsoft has put together some of the parts in the forms.

It’s solid, it doesn’t bog performance, it’s free, and it’s from a reputable company. Can’t ask for much more! Do you have any other ideas or ways in which Fiddler can help? Let us know here!

Advertisements
Tagged , , , , , , ,

CRM 2011: Is that plugin step firing at all?

Here’s a quick and easy tip from our Microsoft PFE, Daren Turner. Let’s say you have a plugin step and that for some reason you’re not able to determine if it’s actually firing off or not. How can you confirm this, without changing code? Easy.

Using the plugin registration tool, go to the plugin step you’re working with and set it to run asynchronously.

async

 

Now, when (and if) it executes, you should be able to see it in the System Jobs grid, and if it was successful or not. There’s a limitation to this, though: You can only do this with Post-Operation steps, because by setting it to asynchronous, you’re in fact turning it into a workflow of sorts.

I hope this helps you out in debugging tricky plugins. Have fun!

 

 

Tagged , , , ,

CRM 2011: Who is really running that child process?

We have recently modified a process where the workflow has to check for a particular time range (done through a custom activity) and if the time at the moment is within the range being checked, the process waits for 30 minutes. At the end of those 30 minutes, it submits itself as a child workflow.

This worked as expected, but we ran into an issue: The remainder of the process needs the user identity to correctly process the entity information. When the process runs normally without the wait timeout, there are no issues. But when it falls in the timeout, and then submits itself as the child workflow, the user identity is changed to that of the workflow owner.

That means that if the owner of the process is, say, your local friendly IT guy, that’s who CRM thinks is running the process, and thus any user-based validations will fail.

The solution for this was to have code in the custom activity that looks for the creator of the entity, and then use that as the user ID needed to execute the user identity-related code. How? We created a function for retrieving the entity owner, and we pass the primary entity ID, as follows:

GetEntityOwner(WorkflowContext.PrimaryEntityId)

This is the code that returns the owner information, and we take it from there:

private Guid GetEntityOwner(Guid entityId)
{
    var myEntity = OrganizationService.Retrieve("new_myentity", entityId, new ColumnSet("createdby"));
    var ownerReference = myEntity.GetAttributeValue<EntityReference>("createdby");
 
    return ownerReference.Id;
}

That fixed the problem and now we get the correct owner for the process to finish successfully.

Have fun!

Tagged , , , , , , ,