Saturday, September 15, 2012

How set Default View for a Lookup field in MS CRM 2011

Step 1: Create two new custom public views on Contact Entity
Step 2: Create a OptionSet field on Account entity name "Contact Types" with two values.
Step 3: Create a new javascript file (FirstJavaScript) with following scripting
function ChangeDefaultLookupViewOnContactTypeChange()
{
var MyValue = Xrm.Page.getAttribute("new_contacttypes").getValue();
if (MyValue == 100000000)
{
 Xrm.Page.getControl("primarycontactid").setDefaultView("XXXXXXXX-XXXX-E111-B30B-080027D26D76");
}
if (MyValue == 100000001)
{
Xrm.Page.getControl("primarycontactid").setDefaultView("XXXXXXXX-F2FE-E111-B30B-080027D26XXX");
}
}

function SetDefaultCustomerLookupOnPageLoad()
{
document.getElementById("customerid").setAttribute("defaulttype", "2"); //2 for contact and 1 for account
Xrm.Page.getControl("customerid").setDefaultView("XXXXXXXX-XXXX-E111-B30B-080027D26D76");
}
Step 4: Customize Opportunity Entity and use "SetDefaultCustomerLookupOnPageLoad" Javascript method on Form OnLoad() method
Step 5: Customize Account Entity and use "ChangeDefaultLookupViewOnContactTypeChange" Javascript method on Contact Types OnChange() method
Note: In case of if you don't know about GUID of Custom Views then use following query on Database:
select SavedQueryId GUID, Name from SavedQueryBase where name in('Custom View 1', 'Custom View 2')

Wednesday, September 12, 2012

Some useful question and answers for MS CRM 2011 interview

Explain some new features in MS CRM 2011.
There are many new featues in MS CRM 2011 like Enhanced UI,OOB Dashboard support,Auditing support,Field level security, Connections,Solution,Webresource, Role based Forms.
Refer: http://www.dynamicsexchange.com/CRM-2011/New-in-CRM-2011.aspx

What are the different webservice available in MS CRM 2011.
MS CRM 2011 have two webservices IOrganization Service, IDiscoveryService

Which service can be used to access metadata information.
We can use IOrganization Service to fetch metadata.

What are the different ways to consume MS CRM webservice from client side?
We can write Rest or Soap request to consume MS CRM 2011 webservices.

Rest Vs Soap.

Difference between Dialog and Workflow.
Dialogs are synchronous process and Workflows are asynchronous process.
We can develop custom workflow, but can’t customize dialogs.
Workflows
Dialogs
Can be either started by a user or can be automated.
Must be started by a user.
Are asynchronous processes, and do not require user input to run to completion. These processes run in the background.
Are synchronous processes, and require user input to run to completion. When you run these processes, a wizard-like interface is presented to you so you can make appropriate selections to run the processes.
The entity that stores the details about a running workflow is AsyncOperation.
The entity that stores information generated by a running dialog is the ProcessSession (dialog session) entity.
Both Windows Workflow Foundation 4 and Windows Workflow Foundation 3.5 custom activities are supported.
Only Windows Workflow Foundation 4 custom activities are supported.
Triggers are supported for workflows. For a list of supported triggers, see Supported Types, Triggers, and Entities for Processes (Workflows and Dialogs).
Triggers are not supported for dialogs.
Workflows that are created or updated outside of Microsoft Dynamics CRM by creating or updating the underlying XAML file are supported in Microsoft Dynamics CRM. For information about these custom XAML workflows, see Custom XAML Workflows.
Dialogs that are created or updated outside of Microsoft Dynamics CRM by creating or updating the underlying XAML file are not supported in Microsoft Dynamics CRM.


What is Solution?
Solution is a collection of MS CRM 2011 components that can be exported and imported easily from one CRM organization to another CRM organization.

Difference between Managed and unmanaged solution.
Managed solution can’t be customized, but can be uninstalled easily.
Unmanaged solution can be customized, you can’t uninstall unmanaged solution.
Refer : http://msdn.microsoft.com/en-us/library/gg334576.aspx

Is it possible to register plugin through solution?
Yes.

What is field level security?
Using field level security we can hide information based on user security role in MS CRM 2011.
Refer: http://msdn.microsoft.com/en-us/library/gg309608.aspx

How can we use auditing in MS CRM 2011.
Auditing can be configured easily through CRM UI.
Refer: http://www.avanadeblog.com/xrm/2010/09/crm-2011-feature-of-the-week-9132010-auditing.html



What is the use of document location entity in MS CRM 2011.
Document location entity is used to store location of crm record which point to a document folder in share point.

How can we create a custom Ribbon button.
To create a custom ribbon button we need to modify RibbonDiffXml of the entity where want to place our button. We can use different ribbon editor tool in codeplex or can manually modify it, you can refer my post to create custom ribbon button.

How can we rename a system Ribbon button.
We can do this by modifying ribbondiffxml, but we need to get current ribbon button id, that we can get from the sample ribbon generator application that comes with Microsoft CRM 2011 SDK.

How can we open a custom webpage from ribbon button.
We can use Action to open custom page

How can we use Filtered views in MS CRM 2011.
Filtered view is a way to enforce security as database level, while working with report we use Filtered view to fetch data based on user security role. Microsoft CRM 2011 contains filtered view for every entity.

What is Webresource and what the different types of webresource.
Web resource is new feature in Microsoft CRM 2011, which is used create reusability of the code and other component. We can create different type of web resource in Microsoft CRM 2011 for example javascript, Image, silverlight, CSS and HTML page.

How can deploy a Silverlight webresource in MS CRM 2011.

What is the use of subgrids?
Subgrids are used to display any entity view in another entity, you can add subgrids from Insert tab while customizing entity form and can select entity to display view in that subgrid

What are the basic steps involved in developing plugin.

What is the use of tracing Service in plugin development.
This is a new feature in Microsoft CRM 2011, using tracing service we can get more error details and can display them to user.

What are the new messages introduced for plugins in MS CRM 2011?
Microsoft CRM 2011 has introduced many new entities, you can refer new entity and their messages in “message-entity support for plug-ins” files that comes with Microsoft CRM 2011 SDK.

What is sandbox plugin.
Sandbox plugin is a plugin which runs under Isolation mode. All Microsoft CRM 2011 plugin writing for online is registered in sandbox mode.

What are the different ways to create custom report for MS CRM 2011.
Fetchxml and SSRS.

Difference between Early bound and late bound.
Early bound – Easy to code, you don’t need to remember field’s name, compile type checking, required extra efforts to generate early bound classes.
Out bound- you should know fields name, run time checking, performance wise better than early bound.
Refer: http://msdn.microsoft.com/en-us/library/gg327971.aspx