Sharepoint webpart example for Microsoft CRM 4.0

In this example , i would like to display Microsoft CRM Opportunities (In Progress) in sharepoint as Pie chart and “Legends” with the help of  sharepoint webpart.


I have two list which are having data from Microsoft CRM.

List<decimal>EstimatedRevenue = Revenu();

List<string> Customers = CrmCustomer();

I used the .Net 3.5 chart control to create the pie chart and I binded this data with the help of DataBindXY(xValue,YValue);

Chart1.Series[“Default”].Points.DataBindXY(Customers, EstimatedRevenue);

I added the “Legends” and then used the” LegendCellColumn” to add different columns. One can enable the 3D by simply

Chart2.ChartAreas[“ChartArea1”].Area3DStyle.Enable3D = true;

List<decimal> IDD = MyVal();
List<decimal> estimated = MyEstimatesharepoint

mscrm_log and sql timeout error in Microsoft CRM 4.0

Is your MSCRM_log file getting bigger and bigger? Have you ever considered looking at MSCRM_log.LDF?

The first thing you witness is sqltimeout error and it is almost impossible to use CRM application. If you look at SQL logs, there will be something  like


In order to overcome , one need to shrink the log database file. Remember to take the back-up of CRM database and then go through from these two figures.


Right click CRM Database …Task…Shrink and then choose ….Files. Now one need to choose mscrm_log.


This process will release unused pages. If logfile does not get smaller then you need to check the properties of Database if Option of “Full Recovery” is selected ? Change it to “Simple” and then shrink it. Remember to change it back to Full recovery once you are done .

Example of Integration of Microsoft CRM with ERP system (Dynamic C5)

In this example , i would show the data from Microsoft Dynamic C5 in Microsoft CRM 4.0.  I will be doing it in few simple steps:

1. I have page which is used to get the ID from Account through Request.QueryString method.


 2. I will be using “Account No” from Microsoft CRM to retrieve the data from Dynamic C5. In the left panel i have “C5 Integration” as Account Left Nav Bar item. When user clicks it , page gets the data from ERP System.

It is simple “SQL Data Table” which is populated with the data from ERP  system while passing the “Account No”.


3. If we select a row by clicking on “vælge” (select) then it will open the more detail about activities of Customer. Here i am passing the ID of one of the column in current row to get more detailed information.




Custom fields in Custom workflow

By using custom workflow , i will make Auto-numbering in CRM 4.0 .


I have created a readonly field on Account entity” new_auto” to hold the “Guid” of

Account. As GUID is always unique , so there is no question about it being duplication. We can use prefix whatever we want.  As one can see AC- (GUID). I will use cutom workflow to obtain the GUID of entity when it is created and then update the entity with the prefix+ GUID.






using System;

using System.ComponentModel;

using System.ComponentModel.Design;

using System.Collections;

using System.Drawing;

using System.Workflow.ComponentModel.Compiler;

using System.Workflow.ComponentModel.Serialization;

using System.Workflow.ComponentModel;

using System.Workflow.ComponentModel.Design;

using System.Workflow.Runtime;

using System.Workflow.Activities;

using System.Workflow.Activities.Rules;

using Microsoft.Crm.Sdk;

using Microsoft.Crm.SdkTypeProxy;

using Microsoft.Crm.Workflow;

using Microsoft.Crm.Workflow.Activities;

using Microsoft.Crm.Sdk.Query;


namespace Number


      [CrmWorkflowActivity(“OneTest”, “AccountNumber”)]


    public partial class Activity1 : SequenceActivity



        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)




            IContextService contextService = (IContextService)executionContext.GetService(typeof(IContextService));


            IWorkflowContext context = contextService.Context;


      ICrmService crmService = context.CreateCrmService();


      WhoAmIRequest systemUserRequest = new WhoAmIRequest();


      WhoAmIResponse systemUser = (WhoAmIResponse)crmService.Execute(systemUserRequest);


      ColumnSet cols = new ColumnSet();

 //Getting the ID of entity which unqiue itself


      Guid guidID = new Guid(this.objectID.Value.ToString());


          // i am using “AC” before GUID.This field will hold the GUID of account


      string Number  = “AC-=” + guidID;


      TargetRetrieveAccount target = new TargetRetrieveAccount();


      target.EntityId = guidID;

      RetrieveRequest getAccount = new RetrieveRequest();


      getAccount.ReturnDynamicEntities = true;


      getAccount.Target = target;


      getAccount.ColumnSet = new AllColumns();


      RetrieveResponse retrieved = (RetrieveResponse)crmService.Execute(getAccount);


      DynamicEntity regardingAccount = (DynamicEntity)retrieved.BusinessEntity;

 //i am using custom field to hold the value of “GUID” .


      if (regardingAccount.Properties.Contains(“new_auto”))



          regardingAccount.Properties[“new_auto”] = Number;







          regardingAccount.Properties.Add(new StringProperty(“new_auto”, Number));






           return ActivityExecutionStatus.Closed;





        public static DependencyProperty objectIDProperty = DependencyProperty.Register(“objectID”, typeof(Lookup), typeof(Activity1));




        [CrmInput(” objectID”)]




       // [CrmReferenceTarget(“automatic.crm.new_audit”)]

       // public.automatic.crm.Lookup


        public Lookup  objectID






                return (Lookup)base.GetValue(objectIDProperty);







                base.SetValue(objectIDProperty, value);







Finally we need to publish the workflow using developer tool and then calling the assembly from workflow.


CRM 4.0 outlook client -Microsoft Visual c++ Runtime installation error

I recently got stucked in installtion of outlook client for a
customer.There was expection while installig Microsoft Visual c++ Runtime .

exception_Unknown (checkbase.cpp:ccheckBase:: Action:315)





 I tried with removing window XP SP 3 , re.installtion of .Netfrmaework version .

But finally i got success after installing .Net framework 3.5 .

Installation of MS CRM 4.0 on Citrix Presentation Server 4.0.

It is quite easy to install CRM 4.0 on Citrix presentation server 4.0 compare to CRM 3.0 but every user need to configure the outlook client for CRM 4.0 unlike CRM 3.0 (in CRM 3.0 we need to click on script to configure the CRM for every user profile).

Here  are  steps:

1 = Intsall the online version of CRM 4.0 through  “Add /remove” program on
citrix server and remember that they must not be any user on  the server.

2 = when you are finished installation then put the configuration wizard on the
desktop of each user via administrator profile .
3 =Every single user need to configure the profile by using configuration wizard.

Finding license key type/value in CRM 4.0

Open the deployment Manager and click on License . There are three columns providing us information about

1 = Licese Type

2 = Number of licensed users

3 = License Key

In order to find the more detail and real value of license key , please use the Organizationname_MSCRM ( default organization in enterprise edition) . Open the SQL server management studio and run the query . It will bring the all infromation one is looking for about key.

Now you can either compare it with the trial version key if you want to make it sure that it is not a trial version key. The trial version keys are located on :

PS” MSDN keys are not present in database”.