Microsoft CRM notes

May 27, 2009

Error When Deploying Web Applications in CRM 4.0
If you’ve written a web application that you’ve that utilizes the CRM web service and try to deploy it, you may receive the following error:

Microsoft.Crm.WebServices, Version=, Culture=neutral,
PublicKeyToken=31bf3856ad364e35’ doesn’t exist.

The issue is that the application cannot find the Microsft.CRM.WebServices library. I’ve seen a few ways to solve this error. Credit goes to Wes Weeks on finding these:

1. Add the following code to your application’s web.config file:

<add assembly=”*”/>

2. Copy Microsoft.CRM.WebServices.dll from the CRM web root bin directory (For default web site installations, this would be c:\inetpub\wwwroot\bin\) to the Global Assembly Cache (C:\windows\assembly\)

3. Copy Microsoft.CRM.WebServices.dll from the CRM web root bin directory to the bin directory for your web application.

So is any one of these methods better than the others? Well, I think it depends, although I’m no .NET expert. I’m not a big fan of #1 – it seems almost like carpet-bombing.

I think either #2 or #3 would be your best options. If you’re going to have just one web application, then copying the assembly to your app’s bin directory would be fine. However, if you’re going to have multiple web apps, them adding the assembly to the GAC would prevent you from having to add the assembly to each application’s bin folder every time you deploy a new one.


2. Use LinkEntity for relationship lookup retrieval details

3. For FetchXMLBuilder : uncheck the checkbox at the first place(use credentials of login user)

 Go with administrator, swayam1,protitan

4. multiselect lookup

5. iisreset

restart microsoft crm asynchronous service

JavaScript=”‘../Pages/Home.aspx?opid=’+ crmForm.ObjectId, ”, ”);”>

           <Button Icon=”/_imgs/ico_18_debug.gif” PassParams=”1″ WinParams=”” WinMode=”2″ JavaScript=”window.showModelessDialog(‘../Pages/Home.aspx?opid=’+ getSelected(‘crmGrid’), ”, ”);”>

   <Entity name=”product”>
       <Title LCID=”1033″ Text=”Actions” />
      <MenuItem Url=”” PassParams=”1″ WinParams=”” WinMode=”2″ JavaScript=”‘../Pages/Home.aspx?opid=’+ crmForm.ObjectId, ”, ”);”>
        <Title LCID=”1033″ Text=”Send License Key” />
      <MenuSpacer />
      <MenuItem Url=”” PassParams=”1″>
        <Title LCID=”1033″ Text=”Generate License Key” />
      <MenuSpacer />
      <MenuItem Url=”” PassParams=”0″>
        <Title LCID=”1033″ Text=”Generate Offline License Key.” />
      <MenuSpacer />
   <!– <Grid>
                <MenuItem Url=”” WinMode=”1″>
                    <Title LCID=”1033″ Text=”Coming Soon…” />
                <Button Icon=”/_imgs/ico_18_debug.gif” PassParams=”1″ WinParams=”” WinMode=”2″ JavaScript=”window.showModelessDialog(‘../Pages/Home.aspx?opid=’+ getSelected(‘crmGrid’), ”, ”);”>
                    <Title LCID=”1033″ Text=”License Mgmt” />
                    <ToolTip LCID=”1033″ Text=”License Management” />



Fetchxmlbuilder not getting the custom entities and attributes

Microsoft Dynamics CRM –> Deployment Manager –> Organizations

Right C lick

Disable unwanted organizations
And set default organization for the desired one.



this is used when we created relationship between two entities

it is like join (inner ,outer , natural) in slqserver


 I have product and contact entities. From Product I created a N:1 relationship with Contact and in the product form I got contact lookup
 <fetch mapping=’logical’>
                                 <entity name=’product’>
                                  <attribute name=’name’/>
                                  <filter type=’and’>
                                   <condition attribute=’productid’ operator=’eq’ value='{0}’/>
                                  <link-entity name=’contact’ from=’contactid’ to=’wi_relatedcontactid’ link-type=’inner’>
                                   <attribute name=’emailaddress1’/>
                                   <attribute name=’fullname’/>

from ,to are like  “on condition”

select * from t1,t2
on t1.c1 = t2.c2


Modelled window not closed

field in active view crm not removed.



I want to create custom email template from different custom entities.
Right now CRM 4.0 has giving some 8 system entities.
How to get custom entities

I want to create custom email template which takes inputs from different custom entities. But here in CRM 4 it is giving only some 8 system inbuilt entities. How to achieve the task

Replace the string with the Record’s Attribute value
Ambati(66 371249 @ Edison) said:
yes got it.
friend said:
gr8…….  grasped so fast
Ambati(66 371249 @ Edison) said:
one more .. can we get a menuitem under Actions  menu of every view?
Ambati(66 371249 @ Edison) said:
I dont want to add another custom button . But want to use the existing Actions menu and want to create a menuitem under it.
friend   said:
We can create our own Menu Item or Button on every entity Grid
friend   said:
No Provision to Include Items in Existing Grid
friend   said:
Ambati(66 371249 @ Edison) said:
I dont want to do that. I want to use the existing Actions menu


WIndows service issue:
Installer file not found during installing windows service using installutil.

Just rightclick on design of service page. Select “Add installers”
Then another file gets created having two controls on it by default.
Remove InstallState file because there are no installers.

Account:  Localsystem
GenerateMember : true
Modifiers  : Private
Parent :  ProjectInstaller



GenerateMember : True
Modifiers:  Private
Parent: ProjectInstaller
ServiceName: CacLicenseVerifier
StartType: Automatic

It sounds like you didn’t create an installer for your project. Within your
project add a new Installer class (it’s an option in the VS.NET “Add Item”
list). To that installer add a ServiceInstaller and a
ServiceProcessInstaller (both listed in the Components browser). Set their
properties (the service name of the serviceinstaller must match the name of
your service) and then recompile and re-run InstallUtil. You shouldn’t see
the message about “No public installers” and you should see your service
added to the list of available services.


iisapp.vbs in dos prompt gives which application in running in which application pool


Customization Comparison Utility (ravi shankar)
New Powerful Tool Customization Comparison Utility has been released for Microsoft Dynamics CRM. The Customization Comparison Utility lets you compare the customization files between two Microsoft Dynamics CRM systems. We shall use the same Utility to Track our Customization changes.


how to create autogenerated column in CRM

Error: The VirtualPathProvider returned a VirtualFile object with VirtualPath set to ‘/WiproInfotech/GetNextProductNumber.cs’ instead of the expected ‘//WiproInfotech/GetNextProductNumber.cs’.
for MS CRM coding use vs 2005 environment
if we  use vs 2008 the above error comes because system.linq and system.linq.xml namespaces

There is an interesting topic on the CRM Forum about how to format an integer field without commas. For example, if you type: 123456 in an integer field, you may see 123,456 once it loses focus. CRM automatically add a ‘,’ between 3 numbers. There’s a global setting to get rid of it, however, it will get rid of all integer field format. How about if you just want to remove the format for just one field?

As you may know, MSCRM uses htc files to format the different type of input fields as same as email address etc, see my another post.

If you want to get the value of an attribute, in CRM we use: DataValue, e.g: crmForm.all.new_number.DataValue;
Notice that the DataValue is the real data saved in the database.

However, if you want to get the formatted value, you may use this:

So the trick is give the DataValue overwrites the value property.

Put the following code into the entity’s onLoad() event, and the same code puts into the field’s onChange() event.
view plaincopy to clipboardprint?
if(crmForm.all.new_number != null && crmForm.all.new_number.DataValue != null) 

 crmForm.all.new_number.value = crmForm.all.new_number.DataValue; 

if(crmForm.all.new_number != null && crmForm.all.new_number.DataValue != null){ crmForm.all.new_number.value = crmForm.all.new_number.DataValue;}
if u r placing dlls in wwwroot\bin folder then those dlls should have “Network” and “Network Service” read permissions.Otherwise access denied error will be shown in eventviewer(run -> eventvwr)
section change properties go to formatting tab default is Two columns(1:1) means two columns will be in one row.
Select a field in a form
click change properties
go to formatting .. Default selection is one column
make it as two column. Now the column occupies the entire row and moving the second column into next row.

if u dont want to increase the size and u want (one column in one row with the column shouldnt occupy the entire row) then change properties go to format tab then make it as one column.


Global variables in MS CRM

How to get organisation name in MS CRM


how to give our own image to the custom entities?
Ambati(66 371249 @ Edison) says:
Hey Chandan..
friend    says:
in the action u will get update imgae option
friend    says:
go to customization
friend    says:
open the entity..
friend    says:
go to action menu.. u will get the oprion..

In CRM for every form we are getting owner . I dont want that .. How to achieve that?
Ambati(66 371249 @ Edison) said:
Owner is a builtin attribute
I dont want that in my custom form
how to delete that from the form? it is not deleting .first of all I couldnt able to remove the business required option to remove that?

sol: while creating entity itself select ownership to organisation instead of user
How do I send email to entities other than account, contact, leads and
I am trying to use a CRM queue for support. The e-mails to a particular email address go into this queue. A user accepts the e-mail. They open it and attempt to reply to it inside CRM. The CRM system will not reply to the message, it seems, because there is no record of the user in the CRM system.

Solved… I had already looked for a setting to fix this multiple times. One last time I checked the System Settings and on the Email tab there is a checkbox for “Allow messages with unresolved e-mail recipients to be sent.” Check yes and it clears up the issue, amazingly enough. 😉


public bool SendEMailK()

            CRMService.activityparty fromParty = new CRMService.activityparty();
            fromParty.partyid = new CRMService.Lookup();
            fromParty.partyid.Value = new Guid(“1D15E6EC-6F81-DD11-8D2E-0003FFDADD5A”);
            fromParty.partyid.type = CRMService.EntityName.systemuser.ToString();
   = “First name Last name”;

            CRMService.activityparty toParty = new CRMService.activityparty();
            toParty.partyid = new CRMService.Lookup();
            toParty.partyid.Value = new Guid(“00E100BD-0CED-DD11-B90A-0003FF5A0FAB”);
            toParty.partyid.type =;
   = “JagFirst JagLast”;
   email = new;
            email.from = new CRMService.activityparty[] { fromParty };
   = new CRMService.activityparty[] { toParty };

            email.subject = “Subject of email”;
            email.description = “Description of email”;

             Guid emailId = _service.Create(email);          

            CRMService.SendEmailRequest sendRequest = new CRMService.SendEmailRequest();
            sendRequest.EmailId = emailId;
            sendRequest.IssueSend = true;
            sendRequest.TrackingToken = “”;

            return true;

Instead of those lines

I want to write

Toparty Emailid=
FromPartyEmailId =

How to write the code now?
I don’t want to send to contact ,user entities.
Deepak  Gupta told me that in system settings Email -> Allow unresolved mails to  yes we can send mails to any mail id like gmail etc.
It is working.
In the email I don’t want to mention user entity or contact entity. Just  in a webpage I will type email address and if I press on SendEMail button it should go to that email .
How to achieve??

Sreedhar Ambati
Proteans  66 371249 @ Edison



ok.             u know how to do filtered lookup???
friend   says:
hmmm…its not supported…
friend    says:
One way is create you own custom lookup page and display that on click of the lookup icon
friend   says:
Unsupported way: you have to make some modification in CRMWeb\_controls\lookup\lookupsingle.aspx page of CRM
friend   says:
Got the second method from CRM community site… Please google. I dont have the exact link now
Ambati(66 371249 @ Edison) says:
if u have sample code please send it. I understood what u said.
friend   says:
I have to serch…is it very urgent now
Ambati(66 371249 @ Edison) says:
yes please
friend    says:
friend    says:
For the secong option you can refer this link
friend    says:
First option : we have not made a proper custom page till now
CRM filtered lookups

I followed the below approach
state city concept :
Lets assume that in web application
we have state dropdown based on the selection of the state its relevant cities are populated in another dropdown.

I used filtered lookup in MSCRM

I created three entities State,City,PlaceHolderEntity

In state .. I have one attribute by name Jagstate
In City … I have CityName attribute and created n:1 relationship with State  and added on the form and view.
            In CityLookup view  clikc on “Add Find Column ” and added State

In PlaceHolder I created n:1 relationship with state and city  (relationships names are stateid and cityid) and added on form and view
               On PlaceHolder Form onload I added the below code
                                 document.FilterLookup = function(source, target)
           if (IsNull(source) || IsNull(target)) { return; }

           var name = IsNull(source.DataValue) ? ” : source.DataValue[0].name;

           target.additionalparams = ‘search=’ + name;

               On Field State Onchange I added the below code


   document.FilterLookup(crmForm.all.wi_stateid, crmForm.all.wi_cityid);


sending mails to gmail or hotmail

Administration -> system settings
email tab
set email form option
Allow unresolved

How to extend vpc ?

custom menus are not displaying which are added in isv.config?

go to settings –> Administration –> System settings –>   customization

There is a dropdown where we have to select webapplication