Posts Tagged CRM

Error while publishing entity in CRM 2011

I was getting the below error while  publishing a particular entity as System Admin  in CRM 2011, though was not getting the error for other entities . The error was

The Requested record was not found or you do not have sufficient permissions to view it.”

The details of the error are :

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: role With Id = 3adccc07-6293-4cac-b790-4be053184063 Does Not ExistDetail:
<OrganizationServiceFault xmlns:i=”; xmlns=””&gt;
<ErrorDetails xmlns:d2p1=”; />
<Message>role With Id = 3adccc07-6293-4cac-b790-4be053184063 Does Not Exist</Message>
<InnerFault i:nil=”true” />
<TraceText i:nil=”true” />


The below link helped me to solve the problem which was removing the extra form for this entity, I had 2 forms out of which one I was not using.

Though I do not fully agree on removing the extra form concept just to get rid of this problem,because this may not be the actual Problem but u know when something works for us we take it with both hands……





Leave a comment

Exporting SSRS report to Word giving Error in CRM 2011

Recently in my Project I was getting a error for one of the report when I was trying to export to Word. Having not faced this issue before we started to hunt for the solutions. Then came to know that if the report is having more no of individual controls then while rendering that to word gives issues. To get rid of this you can group the controls in some other control(For Eg. Rectangle).

And here u go  …. your issue fixed ….

Below URL is a handy one  …

, ,

Leave a comment

By default all fields getting updated issue while using oData(REST) endpoint for Web Resources in Silverlight in CRM 2011

Recently I was facing a typical issue, while updating a couple of fields of a form using REST Endpoint in Silverlight, by default all the fields in the form was getting updated to null. I found this as very strange behavior by using REST in Silverlight.

In seek of answer I found that it was the default feature when you use REST Endpoint in Silverlight in CRM 2011.

The Below URL helped me lot which talks in very detailed manner the actual cause and Resolution.

Happy Reading …

, , , , ,

Leave a comment

Update Rollup 6 for Microsoft CRM 2011

Hey Guys, Microsoft has released Update Rollup 6 for CRM 2011 with many changes and fixes. You must have Microsoft Dynamics CRM 2011 build 5.0.9688.583 installed to apply this update rollup. You can get the latest Update Rollup 6 from

For the list of new improvements and changes you can go through the below KB article

, , ,


Activity Feed in CRM 2011

Activity Feed is a very interesting features introduced in CRM 2011. But it has not become as famous as it should be and one of the most obvious reasons may be that still it has few Question (?) marks that needs to be answered or solved when it comes to security and usability in an efficient manner.

In my opinion still some of the features can be improved as of now in order to accept this globally. But still what we have is lot to cheer about. Why I am dough ting at this time I will clarify later in this post.

Let see how we can use this and take the most out of it.  You can get the Activity Feed solution from the Dynamic Marketplace in CRM Settings tab or you can just do Google. The CRM 2011 server setup that was released before Nov 2011 does not contain this solution. So you have to download and import it manually. But in all the latest CRM versions that are coming after Nov 2011 have this activity feed solution installed from before whether it is Online or On- Premise.

Let’s understand the common terms associated with this. We can say it can act as a Twitter for the CRM users plus lot of many other functions.


Post is an Entity and whatever you write is saved internally as a record. So every item on your wall is a post. It is yet like another entity. You can create new post through Plugin, workflow etc. You can even trigger anything on different operation performed. We will see how to create a post from workflow to meet our business need.


Wall is nothing but the UI html page what we see where all the posts are visible. Records even can have wall and a tab ‘Record Wall’ can be seen for that record.


Follow and Unfollow are the two options that will be visible for all entities but will be enabled for only those entities for which the activity feed will be configured.

Configuration of Activity Feed

After importing the solution you will find three links in what’s New in the Workplace Area and the other two as shown below

Let’s configure some entities. Click Activity Feed Configuration and create records for the entities which we want to configure. Remember give the schema name of entity and not the display name.

The interesting thing I found that we cannot define Rules for the entities. Because we cannot find any add New Rule or Existing button. However the system creates few rules for the few entities that exist from before like Lead, Opportunity, etc.

We can configure for custom entities also but cannot define rule directly which I found the funniest part. I hope that issue gets solved in the coming versions /updates. At present if we want to define some rules for custom entities than we can do that by configuring with a workflow.

For following a multiple records we can do Advance Find select the records to Follow or UnFollow.

Workflow to create a Rule and Post Automatically for Custom Entity

We will see how we can configure activity feed for a custom entity. This can be done through a workflow.  Let’s take a custom entity called “Investor”. So whenever investor is created by any user then we will post stating that an Investor is created. Let it act as a Notification. Let it as simple as this. Anyways we can do a lot and configure the workflow for our custom logic but here we are going through a sample.

        1. Create a Process of category as “Workflow” and configure for ‘When record is created’ as shown below

          2. Now we will configure the properties.

Here we can see the Dynamic value assigned called “Post URL (Dynamic)“. This option is only visible when we have the latest Update Rollup installed. This is basically used to provide a link to that record. So we can open that record by clicking this. This is a new feature update from Microsoft in CRM 2011. Really this is very helpful while creating email form the workflow. We can directly open the record from the Email.

Anyways configuring this workflow save and Activate this workflow.

Result: Now whenever the Investor record is created automatically a post will be created. We can see this post in the What’s new  in the Workplace Area. Here we have created investor record DTest10.

Note: Yet a lot of things are missing and I think that it needs to be improved a bit more so that it can be accepted widely. Few things that are strange or lack in the current version of the solution are in my opinion are:-

1. We cannot create Rules as per our choice for the entities. Eventually we opt for Workflows to configure. 

As we can see that there is no New Button to add any Rules.

2.  The post lacks security. This means that anybody who can view that post can delete that post which will be deleted from the system. This means that the person that created that post is not the sole owner of that post. Even we cannot set anything from the roles and permission point of view.

3. The system creates rules for some of the predefined entities like lead, contact, opportunity etc. We can’t add the rules to the entities configured and yet there is Grid where it can be added.

So these were my concerns in terms of usability. Hope this gets better in the coming versions or update.

 Happy Reading !!!!!!!

, , , , ,


SharePoint Integration with CRM 2011

CRM 2011 has introduced the concept of Document Management which is nothing but managing and keeping the document properly so that we can use of the documents in the most efficient manner. Integration with SharePoint was possible in the previous versions of CRM also but in 2011 things are really more efficient and organized. With the help of SharePoint we can avail and use most of the features of SharePoint in Microsoft CRM.

CRM 2011 can be integrated with both Sharepoint 2007 and 2010. But there are quite some difference visualization wise. If the CRM 2011 is integrated with 2007 we will be able to see the whole data in an IFrame, whereas with Sharepoint 2010 we have both the options i.e to see in an IFrame as well as properly organized documents list folder wise. We can create folders in Sharepoint with the CRM List Components in CRM 2011 which I will talk later.

CRM 2011 can be integrated with both On-Premise and Online and with the below versions

  • Microsoft SharePoint 2010 – almost all versions.
  • Microsoft Office SharePoint server 2007

CRM List Component

CRM List Component is a solution component that allows CRM to create folders automatically in Sharepoint and thus helping us to view the documents in the form of List in CRM. If it is not installed then the whole Sharepoint site will be visible in CRM in an IFrame. I strongly suggest to install the CRM List Component in order to get a good List View (Documents) in CRM.

You can download the CRM List Component from the below location

Now we will see how to integrate with Sharepoint with and without CRM List Component.

Integration of Sharepoint without CRM List Component

1. Go to Settings –>Document Management –>Document Management Settings

2. We can select the entities for which we want to enable the Document Management. By default some of the entities like Lead, Opportunity etc. will be selected. Provide the Sharepoint Site’s URL.

3. It will verify the Sharepoint Site and if everything is fine it will say that the URL is a valid one. Complete the configuration wizard.

4. Now we will configure for the lead entity. Open any Lead Record and Click on Documents.

5. After saving you can see the Sharepoint site in an IFrame as below.

Integration of Sharepoint with CRM List Component

With CRM List component we can see only the related documents in a list type and not the whole Sharepoint Site. Let’s see how we can install the list component in Sharepoint Server.

You can download as well as follow the instructions from the below URL.

After adding the solution component in the Sharepoint Server you should activate the solution.

Sometimes after installing the solution [CRM List Component] it gives a lot of pain while activating it. Because of my bad luck I went through the pain due to errors. If you are going through hard luck then you may get the error like ‘The sandboxed code execution request was refused because the Sandboxed Code Host Service was too busy to handle the request.’ Please follow the below link to solve the issue.

Now after successfully activating go the CRM and try configuring this time. This time you will get a Window as below stating where the folders will be created.

After completing this wizard now if you will open any lead record and click on Documents then only the documents list will be visible and not the whole Sharepoint site.

I hope this really helps you. For more information related with Sharepoint Integration with CRM 2011 I found the below links very helpful.

Happy Reading!!!!!!!!!!!!!!!!!!

, , , ,

1 Comment

Retrieve Option Set Selected Text Value in CRM 2011

Retrieve Option Set Selected Text Value  in CRM 2011

In CRM 4.0 it was very easy to get the Picklist Selected Text value. But in CRM 2011 the Picklist has been changed to Option Set and interestingly they have not exposed any Property to get Text value of the selected value.

So now we can get the value only from the Metadata. It’s not huge but simple to implement. Below is the method which returns the Selected Text Value on Passing the Integer Value.

public string GetPickListText(string entityName, string attributeName,int optionSetValue,IOrganizationService service)
    string AttributeName = attributeName;
    string EntityLogicalName = entityName;
RetrieveEntityRequest retrieveDetails = new RetrieveEntityRequest
    EntityFilters = EntityFilters.All,
    LogicalName = EntityLogicalName
 RetrieveEntityResponse retrieveEntityResponseObj = (RetrieveEntityResponse)service.Execute(retrieveDetails);
 Microsoft.Xrm.Sdk.Metadata.EntityMetadata metadata = retrieveEntityResponseObj.EntityMetadata;
 Microsoft.Xrm.Sdk.Metadata.PicklistAttributeMetadata picklistMetadata = metadata.Attributes.FirstOrDefault(attribute => String.Equals(attribute.LogicalName, attributeName, StringComparison.OrdinalIgnoreCase)) as Microsoft.Xrm.Sdk.Metadata.PicklistAttributeMetadata;
 Microsoft.Xrm.Sdk.Metadata.OptionSetMetadata options = picklistMetadata.OptionSet;
IList<OptionMetadata> picklistOption = (from o in options.Options
 where o.Value.Value == optionSetValue
 select o).ToList();
string picklistLabel = (picklistOption.First()).Label.UserLocalizedLabel.Label;
 return picklistLabel;

Now by using this we can easily get the selected option set value of any attribute of any record. Now to retrieve the text value we need to pass the value of the option set.

For e.g [How to call] To Get the selected text for Shipping method for a contact record

IOrganizationService service = GetCrmService();//Get the Crm Service 
string textValue=GetPickListText("contact","address1_shippingmethodcode",5,service) ;

I hope this really helps. HAPPY Reading !!!!!


, ,


Filtering records of any entity on top of Role and Permission

Filtering records of any entity on top of Role and Permission

Many times as a developer point of view we get some requirements which are complex in terms of designing and to meet such type of requirement we look to find an alternative solution.

Recently in my project I faced an issue regarding the Security Role for a Specific Type of User(Role). I would like to share the scenario. I had to filer the records of a particular entity dynamically based on a PickList value of that form. I mean in real the problem and the requirement was much more complex but let not focus on that. Let’s see how we can filter the record on top of the role privileges.

To solve my problem I wrote a plugin and registered for a RetrieveMultiple message.

// Obtain the execution context from the service provider.
IPluginExecutionContext context=(IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
if (context.Mode == 0 && context.Stage == 20 && context.MessageName.Equals("RetrieveMultiple"))
  if (context.InputParameters.Contains("Query"))
     if (context.InputParameters["Query"] is QueryExpression)
         QueryExpression objQueryExpression = (QueryExpression)context.InputParameters["Query"];

       if (objQueryExpression.EntityName == "entityName")
          IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
          service = serviceFactory.CreateOrganizationService(context.UserId);
          ConditionExpression conExpress;
          string role = string.Empty;

          role = getUserRole(context.UserId);//Method to get the role of logged In User
          if (role.Contains("roleName"))
             conExpress = new ConditionExpression()
                AttributeName = "attributeName",
                Operator = ConditionOperator.Equal,
                Values = { "1" }
           // show all for legal , finance, system admin

           conExpress = new ConditionExpression()
             AttributeName = "attributeName",
             Operator = ConditionOperator.In,
             Values = { "1", "2", "3" }

       FilterExpression newFilter = new FilterExpression()
           FilterOperator = LogicalOperator.Or,
           Conditions = { conExpress }


Here I have used the method getUserRole() but not shown in the code. We can get the role easily by using Linq, FetchXml or any other means. Anyways that was not the agenda for this article.

I have tested this plugin & its works fine without any Performance Issue. Below I have shown the registration steps for this plugin.

Note: If you are checking the entityname inside the plugin then its fine you can register the plugin as above otherwise you c an mention the entityname also in the Primary Entity in the above registration  step.

This RetrieveMultiple can be used for multiple purposes for eg for filtering of records in Lookup etc. I hope this really helps.  HAPPY READING !!!!!!!!!!!!!!!!!!

, , , ,

1 Comment

PreEntityImages and PostEntityImages In CRM 5.0 / 2011 Plugins

PreEntityImages :

It is basically used to capture the data when the form loads. That is the data which is present by default when the form loads.  The syntax for using the PreEntityImages in CRM 2011 is changed as compared to CRM 4.0. Remember the PreEntityImages cannot be registered for “create” operation.

Syntax Used in CRM 2011 :

Suppose you registered the Plugin and added a Image with name “PreImage

Entity preMessageImage;

if (context.PreEntityImages.Contains(“PreImage”) && context.PreEntityImages[“PreImage”] is Entity)


preMessageImage = (Entity)context.PreEntityImages[“PreImage”];

accountnumber = (String)preMessageImage.Attributes[“accountnumber”];


Here Entity is an Class that is available in the Microsoft.Crm.Sdk.dll

PostEntityImages :

The Post Image contains the attributes value which are finally changed. We can capture the changed data before the database operation takes place. And can do any kind of validation based on the changed data. Remember it can only be registered  for update message and cannot be registered on create message.

Syntax Used in CRM 2011 :

Suppose you registered the Plugin and added a Image with name “PostImage

Entity postMessageImage;

if (context.PostEntityImages.Contains(“PostImage”) && context.PostEntityImages[“PostImage”] is Entity)


postMessageImage = (Entity)context.PostEntityImages[“PostImage”];

accountnumber = (String)postMessageImage.Attributes[“accountnumber”];


The PreEntityImages and PostEntityImages are Very useful in Scenarios where we want to compare the data that is changed by the user. Based on the changes the custom operation can be performed.

The below PLugin shows the use of PreEntityImages and PostEntityImages.The plugin creates a contact record when a account record is updated. The plugin uses late binding or Dynamic Entity concept for the creation of the record.

PreEntityImages concept

, , , ,