Tuesday, February 28, 2012

Using SetStateRequest to deactivate Contact record.

Recently I wintered to deactivate contact entity for some scenarios. below is the piece of code which I used to do it so.



public void DeactivateContact(Guid contactId)
{
try
{
SetStateRequest setStateRequest = new SetStateRequest();
setStateRequest.State = new OptionSetValue(0);
setStateRequest.Status = new OptionSetValue(1);
setStateRequest.EntityMoniker = new EntityReference(Contact.EntityLogicalName, contactId);

service.Execute(setStateRequest);
}
catch (Exception exception)
{
throw exception;
}
}

Monday, February 27, 2012

Visual Ribbon Editor for MS CRM 2011

In CRM 2011 Editing ribbon is a very hard thing. because we have to change lot of xml files. But Visual Ribbon Editor is a wonderful tool which will enable you to edit CRM ribbon more easily, definitely it will make your life more easier .

You can download it from codeplex

Sunday, February 26, 2012

Reload CRM 2011 sub-grid manually

Recently I wanted to add a subgrid to the one of my CRM form. It's a simple thing you just want to follow the normal procedure.

1. Settings - Customizations - Customize the System

2. Open the entity form and go to the Insert tab and click on Sub-Grid button


3. Now give a name for "Name" field then select Entity and Default View
ntity form and go to the Insert tab and click on Sub-Grid button

That's it. Save and publish the form.

Normally now all of the sub records should populate in the main form load. But in my case it didn't load the sub grid records, so just had to find a reason for that. actually in my main CRM form there were more than 10 sub grids. Finally I came to know that it will load only first 5 sub grids in the page load. So then we need to manually load my sub grid using javascript. It was not that much default you can simply use the following javascript code.




var grid = document.getElementById("SubGridName");
if (grid != null) {
if (grid.readyState == "complete") {
grid.Refresh();
}
}

Thursday, February 23, 2012

CRM 2011 How to change attribute type in database

Recently I wanted to change the attribute type from 'Single line of text' to 'Multi line text' in CRM 2011. but we cannot do from CRM form. but there is a way to do it.

First you have to find the Single line attribute and multi line attribute from the "Attribute" table. and get the attributetypeId.

then simply update the Multi line attributetypeId with single line attributetypeId.

After that you have to Export the Entity and then Import it again to the CRM system.

Now open the Entity Form and remove the attribute and add it again to the form.

Save and Publish the Form.

That's it. now you will see the changes. btw, this is 'UNSUPPORTED' way.

MS CRM 2011 KB Article customization Issue.

Recently I have encountered some issue while customizing Kb Article Entity. I was doing following configuration in Article form. 1. Add Ba...