Showing posts with label Useful Tips. Show all posts
Showing posts with label Useful Tips. Show all posts

Friday, 3 December 2010

Infinite Loop Detection in CRM Workflows

Annoyingly, if you have a workflow that calls itself or a child workflow more than 7 times in an hour, you've probably runi in to CRM infinit loop detection. Basically, if CRM detects this happening it will step in and shut down the whole workflow.

However, you can chage the setting (provided of course that you know what you are doing and that your workflows are well written) to a greater number. You do this using the CRM Deployment Config Tool.

For example, if oyu need to up the number of loos from 7 to 20, you could use the following command:

microsoft.crm.deploymentconfigtool.exe workflowsettings update -maximumdepth:20

Happy testing!

Tuesday, 21 September 2010

Internet Explorer 8 and broken menus in CRM 4.0

** Please note, this issue is fixed un Update Rollup 9**

I noticed this one ages ago, but I've never really taken the time to sit down and work out what was going on.

Ever since the release of IE 8, I've noticed that the menus seem to overlap in very odd ways. In certain circumstances you even get pop-out menus completely covering the menus underneath them like the image on the side of the page.

Now this is obviously less than idea. Functionality it doesnt make a big difference, but aesthetically it can be very annoying to users... and annoyed users are never fun to deal with! ;)

So I noticed that this was happening predominantly when the CRM server was in the local client's Trusted Sites internet security zone. So after a bit of trial and error I managed to isolate the specific setting causing my headaches... There is a setting called 'Allow script initiated windows without size or position constraints'. This is set to Disable by default in the Trusted Sites security zone. Setting it to Enable solves the issue:

Saturday, 21 August 2010

Can I use a picklist/lookup as my primary attribute?

In my experience it's safe to say that CRM's approach of always needing the primary attribute of a custom entity to be an nvarchar attribute  unfortunately doesn't fit all business scenarios.

Take the example where an organisation has a complex product management scenario where the standard product functionality has to be suppressed and replaced with something more suitable. Within the Account record you may want to see all of the products owned by the organisation. If you have a standard catalogue of products, having to name each one whenever a customer acquires said product is far from ideal.

There are a couple of ways of dealing with this, but I generally like to use JavaScript to plug the 'gap'.

So say we want to have a picklist of 'Product' for our primary attribute on our new product entity, we could do the following:
  1. Create the new entity, schema name of new_product.
  2. In the new entity, give the primary attribute a name of new_productname (Name this 'Product Name').
  3. Create a new pick-list attribute called new_productnamepicklist (Also name this 'Product Name').
  4. Place the picklist attribute front & centre on your entity
  5. Place the primary attribute elsewhere and disable it... I generally use a 'System' section on an 'Admin' tab.
Now we just need some JavaScript to automatically populate the new_productname attribute with the value from new_productnamepicklist attribute. Place the following code in the onChange event of the new_productnamepicklist attribute:

var CRM_FORM_TYPE_CREATE = 1;
var CRM_FORM_TYPE_UPDATE = 2;

if ((crmForm.FormType == CRM_FORM_TYPE_CREATE) || (crmForm.FormType == CRM_FORM_TYPE_UPDATE)){
    //get our value from the picklist - make sure you use SelectedValue, not DataValue as we want the text, not the item code.
    var recName = crmForm.all.new_productnamepicklist.SelectedValue;

    //Set the attribute name
    crmForm.all.new_productname.DataValue = recName;
    //Don't forget to force submit as the attribute is disabled on the form.
    crmForm.all.new_productname.ForceSubmit = true;    
}

Please be aware that while this particular approach is very simple to implement, it has its limitations. As the work is being done on the form, the onChange event will not fire if the record is updated as part of a bulk edit, or if it is created via an import or through the web services etc. If you need a more sophisticated solution to handle those scenarios, you will want to use a plugin - I'll try and write a follow-up with more detail on that approach when I get a chance.

Lastly, if you face this challenge, please be sure to give some thought to your views. If you look at a list of products, there are few things less helpful than seeing row after row of a single product. You will need to add extra attributes to your view columns to make it easy for your user to identify the data they need.