Thursday, June 28, 2012

Multi Selection option Lists in CRM 2011

Sometimes customers ask showing an option list whether it’s possible to have a multi selection list instead of an option list which will let the customer select only one option from the list. Unfortunately this is not supported with CRM 2011.

However there are ways to get this done and the following blog post state a very nice way to get this done. Please note as the author of the post says it’s unsupported.

Cross Brower compatibility with CRM 2011

When speaking about CRM one of the major limitation we had was it was only supported in IE. So most of the users were not too thrilled of the fact that CRM not supporting their favorite Browser (Not all... IE is favorite for most of the cases). But the fact remained that CRM not supporting anything other than IE.

Microsoft has been working regarding this for some time and they have made it to work with chrome and Mozilla. For chrome and Mozilla you have to work with the latest version of them. This is coming with UR 9 of CRM 2011.

However there is a catch. The javascripts that we have been using, some of them will get obsolete as they were targeting IE only. Since with this roll up, we will have to re write them to be compatible with other browsers. Might be a tedious task. But once this is done you will be able to work with almost 3 browsers and like any other traditional .net web app, you will have to check with cross browsers to see the system is working.
More information about this can be found at the following link.

Tuesday, June 26, 2012

Making an EntityReference in a CRM 2011 to Null Programmatically

First of all, is this needed? Yes, we need to do this when working with c# code sometimes where we want to clear a look up field value. 

How can we do this?

It’s very easy. All we have to do is assign null value to the field. That would do the trick.
contact.parentcustomerid = null;

the above statement will clear out the parent customer value in a contact.

Thursday, June 21, 2012 javascript in IE 8

We needed to get the id of an event that fired and we used there. We tested this functionality in IE 9 and Mozilla Firefox and it was working fine. 

However when this was tested with IE 8 it was not working and it gave an error saying that the is null. Strange ha…

So we did some research on this with the help of google and found out that this is not working with IE 8. In IE 8 if you want to get the Id you need to use the srcElement attribute.
So instead of it should be event. in IE 8.

The best way to get this is use the following method. 

var controlId = ( || event.srcElement).id

This would give you the id of the event of the attribute that fired.

Thursday, June 14, 2012

Create a fetchxml structure in CRM 2011

Well, there are times that we need to create fetch xml to retrieve information from CRM web services. This is sort of a tedious task as creating a fetch xml has to be done very carefully. If one character is wrong then we would be getting an error.

In CRM 2011 this has been made is easy for us. All we have to do is to go to advance find and create a query similar to what we want the fetch xml to be. After running the query there is a button which says “Download Fetch XML”. When you click on this a file would be generated and would be downloaded to your PC. This contains the fetch xml that we can use. 

Easy ha….

Retrieving entity information programmatically

There are times that we need to retrieve information related to an entity separately. For an instance if we want to know the primary key field name in an entity or primary field id (this can be taken using the entityname + “id”) of an entity this is useful. The code snippet needed for this given below.
RetrieveEntityRequest retrieveEntityRequest = new RetrieveEntityRequest
                EntityFilters = EntityFilters.Attributes,
                LogicalName = “contact”

RetrieveEntityResponse retrieveEntityResponse = (RetrieveEntityResponse)Execute(retrieveEntityRequest);

if (retrieveEntityResponse != null)
                return retrieveEntityResponse.EntityMetadata.PrimaryNameAttribute;

The above will return the primary field name of the entity.

Retrieving Calendar of a Bookable Resource in Dynamics

There are occasions where we need to retrieve working days and working times of a resource in Dynamics grammatically. This is quite possible...