« Home | Multiple Column Sort in Dynamics CRM » | Display a Google Map for an Account » | ASP.NET Application Deployment Resources » | Visual Studio Error: The project file ' ' has been... » | Progress Bar in Dynamics CRM 4.0 » | Backup, Restore & Publish Dynamics CRM Customizati... » | 'The application is already precompiled' error » | Server Explorer Gone Invisible? » | Month Name from Month Number » | Implemeting SSL in IIS 7.0 »

Change the default entity in Lookup Window

For instance, in Opportunity form of Microsoft CRM if you want to change the “Potential Customer” field’s default entity from Account to Contact. You need to use the following piece of code in onLoad event of the Opportunity Form.

if ( crmForm.all.customerid != null )
{
    crmForm.all.customerid .setAttribute(”defaulttype”, “2″);
}

Remember to enable the event and then save and publish the opportunity entity.
 Following are codes of basic entities of Microsoft CRM 3 ;
  • Account    1
  • Contact     2
  • Lead         4
Thanks to Umar for pointing out this.

Happy Coding...

Labels: , , , , , ,

Post a Comment