Thursday, 20 November 2014

CRM 2013 to 2015 Upgrade

CRM 2013 to 2015 Upgrade
Here I will discuss about important things need to know. I.e. what is changing, what is important and what Microsoft is Recommending
Supported Software
·        Windows Server 2012/2012 R2
·        SQL Server - 2012
·        Windows Client - Windows7 and Windows 8
·        Browsers -- IE 10/11
·        Exchange Server - 2010/2013
·        Outlook - 2010/2013
Discontinuing support
·        Window server 2008/2008R2
·        SQL Server 2008/2008R2
·        Windows Vista
·        Internet Explorer 8/9 (It was used to take to mobile forms but now CRM continues to open normally and features stop working in older versions)
·        Exchange and Office 2007
Server Upgrade Process        
Upgrade is a one-way process CRM 2015 cannot be uninstalled
Two methods to upgrade
·        Install media on current server
·        Migration upgrade (Recommended) deploying another CRM instance with a separate database and it is most efficient way
Upgrade must start from CRM 2013 6.1(Service Pack 1) and Server must be on CRM 2013 SP1 or higher
Upgrade Process
While upgrading process, CRM applies check to determine if it's SAFE to upgrade organization and it provides to link to an article it there is an issue
The issues which will be taken care by the product are informed as part of warnings
Important things to be considered from upgrading CRM 2013 to CRM 2015
According to CRM 2013 architecture there was change in core database structure
·        Collapsed a series of tables to optimize frequency
·        Allowed customers to run in temporary "expanded state"
·        For 2015, the merge process is mandatory for upgrade. The base and extension merge process.
Base and Extension Table merge
All extension tables merged by default during upgrade process as Merge is mandatory for CRM 2015. If database cannot be merged, the upgrade will process will cease and the owner notified
Solutions Framework Updates (Move custom from one to another)
·        CRM 2013 solution could not be imported in CRM 2011
·        CRM 2013 SP1 could not be imported in CRM 2013
With CRM 2013 SP1, CRM Product came with ability to export to a specific version of CRM. CRM 2015 solution will work CRM 2015 deployments and will not imported to CRM 2013. The reason behind this that there is a change in fundamental structure of CRM.
Upgrading Forms form 2011 and 2013
There is change in the forms design in CRM 2013 and it also allowed to retain 2011 forms. Moving forward in CRM 2015 continues the same. CRM capabilities are added to the new forms (2013).
·        CRM 2011 forms are all called with name Information.
·        CRM 2013 forms are called with Entity Name (Account, Lead, Case etc...)
We can activate and deactivate forms.
On CRM 2013 form, you will find a button called Merge forms, that button is only activated on 2013 forms, that allows to choose 2011 and it merges 2011 form to 2013.
You will find more information in Implementation Guide of CRM 2015 SDK.
Happy CRM'ing

Tuesday, 28 October 2014

Scheduled Workflow in CRM 2013/2011

Scheduled Workflow in MSCRM 2013/2011

There was a requirement for us to write an application which should run on every month 1st 12:00 AM.

Approach 1

1.     Create two Date Time fields as ‘WorkflowRunDate’ and ‘FirstWorkingDateOfNextMonth’, which are hidden on the User Entity.
2.     Create a System Workflow (On Demand and Child Workflow).
3.     Create a Custom Workflow

Custom workflow Pseudo Code

If (WorkflowRunDate is null or FirstWorkingDateOfNextMonth Equals to WorkflowRunDate)
Update WorkflowRunDate with Current Date +1
Update FirstWorkingDateOfNextMonth on User Record.
<<This Business Logic >>
            WorkflowRunDate = WorkflowRunDate + 1 Day ( 12:00 AM)

4.     The Wait condition in the workflow will be set to trigger at the time “WorkflowRunDate” for the next consecutive date.

Note: We did find an issue of workflow triggering twice, so added wait for 5 mins steps. As the time is controlled by our custom workflow we didn’t get any issue in adding that step.

1)     The workflow should be triggered manually by the user who has access on respective accounts of the user record.
2)     We should have two fields on the User Record.
3)     We should never de-activate/disable the user record.
4)     Workflow runs for 24/7.
5)     If there are any changes to the business logic, we should check the dates carefully and trigger it again.

Approach 2
1)     Create a Console Application in C# code.

Console Application Pseudo Code
<< Business Logic >>

2)     Schedule it on System’s Task Scheduler with the below Trigger. 

       We should have one Azure server to schedule the application.

Approach 1 VS Approach 2

Approach 1
Approach 2
Triggering is manual
No manual trigger, initial configuration on server is needed
Whenever there is a change in the logic, the workflow should be triggered again.
Its automatic
Date Logic is Programmatical
Task scheduler takes care of it
Dependency on User Record
No dependency on any record
Workflows runs for 24/7
Task scheduler takes care of it
No server needed
Need a server for scheduling the job
Included in Dynamics CRM
Not included in Dynamics CRM
No server maintenance cost
Server maintenance should be taken care

Happy CRM’ing

Friday, 18 July 2014

MSCRM Interview Questions and Answers

CRM Interview Questions and Answers

 1.       Five Groups created in Active directory while installing CRM 2011?
PrivReportingGroup, PrivUserGroup, SQLAccessGroup, ReportingGroup, UserGroup
2.       Plug-In deployment Options and why?
The 3 storage options are: Database, Disk and GAC. The main differences between these  are:
·         Database: The assembly dll is stored in the database, rather than the file system.   The major advantages are that the assembly need only be deployed once if you have multiple CRM servers, and that no additional action is required to restore / redeploy the assembly either during disaster recovery, or if redeploying to an alternate server. This is the preferred option in a production environment
·         Disk: The assembly dll is placed in the \server\bin\assembly directory on each server. You have to ensure the dll is placed in the correct place on all CRM servers, so the deployment overhead is a little greater. I normally use this option in development environments as you can redeploy newer versions solely by file transfer, rather than reregistering. Also, if debugging, the assembly .pdb file needs to be placed in the same location; with this option it's easy to ensure the dll and pdb are from the same build
·         GAC: The assembly is placed in the Global Assembly Cache on each CRM server, and again you will have to do this. The GAC does allow multiple versions of an assembly, but CRM doesn't, so you don't really gain anything by using the GAC.

There is one further consideration. If your plugin assembly has other dependent assemblies, then you can place this dependent assembly in the GAC whichever of the above options you take. However, if you use the Disk option, then the dependent assemblies can also be deployed into the \server\bin\assembly directory
3.       Secure / UnSecure in Plug-In

As you all know the plugin registration tool in CRM 2011 contains Secure and Unsecure configuration sections as shown below.
Following are the two key differences found between these two configuration settings.

Unsecure Configuration

Secure Configuration
Unsecure configuration information could be read by any user in CRM. Remember its public information (Ex: Parameter strings to be used in plugin could be supplied here)
The Secure Configuration information could be read only by CRM Administrators.(Eg: Restricted data from normal user could be supplied here)
Imagine that you include a plugin, plugin steps and activate them in a solution. Later solution was exported as Managed Solution to another environment. In this scenario, the supplied unsecure configuration values would be available in the new environment.
The plugin with secure configuration in a solution was exported as Managed Solution to another environment. In this scenario, the supplied secure configuration information would NOT be available in the new environment. The simple  reason behind this is to provide more security to the contents of Secure Configuration

Below are key differentiations between Secured and Unsecured data configuration
·         Access
o   Data passed through “Unsecure” section is PUBLIC (i.e., It can be read by any user in CRM).
o   Only users with “System Administrator” role have access to the data passed through “Secure” configuration section
·         Storage
o    “Unsecure” config data will be stored along with the Plugin ‘Step’ registration information (i.e., In SdkMessageProcessingStep entity)
o    “Secure” config data will be stored in a separate entity named “SdkMessageProcessingStepSecureConfig”
§  Only “System Administrator” has Read access on this entity, hence only users with ‘Sys Admin’ role can access this data
o    Both “Secured & Unsecured” configuration data stored as “Plain text” in DB

·         Outlook Sync
o    “Unsecured” configuration data is downloaded to the user’s computer when they go offline making it Unsecure
o    “Secured” configuration data is NOT downloaded to User’s Computer when they go Offline

4.       Max Number of controls got allowed in CRM 2011 Dashboard?
6, Can be extended more by using PowerShell script
Refer the below link for more information

 5.       Role Based Vs Object Based Security in CRM 2011?
Code based security is entirely coded in the application itself. Role based security uses one of the authentication/authorization mechanisms of the application server. The  fundamental concept in role-based security is that of privilege, defined at design time, on a system-wide basis. Each user has a set of privileges (there are well over a hundred privileges) that are enabled for that user. However, Policies and Roles grant privileges and simplify the process. The other form of security applies to individual instances of objects. There is a fundamental difference between an access right and a privilege: an access right is a right granted to a user on an object), but a privilege is a right granted to a user on a class of objects. Access rights apply only after privileges have taken effect. In other words, if a user does not have the privilege to read accounts, the user will not be able to read any account, whether or not it has been shared.

6.       Difference between Find and Advanced Find? Which one is faster and why?
Find perform a search on an attribute for which it is defined. Advanced Find perform search on the conditions and the attributes for which user customizes or runs it. Normal Find in faster as it looks for one attributes and matches with that and returns the result whereas Advanced Find searches for all the attributes and conditions while parsing through the records. Find is applicable on only active records and it finds only on 2 or 3 column which we have defined in the find view and even it returns any those column which is there in the view but advanced find is applicable to all the records and it finds all the columns and even it returns all the column and filter criteria can be on any column and most important - find filters on just one condition but advanced find filters on multiple condition at one time.. Find is faster than Advanced Find.

7.       Types of Services in CRM 2011?
Deployment Web Service, Discovery Web service, IOrganization Service.

8.       Asynchronous  Plug-in Vs Workflow
Asynchronous Plugin
a)      Plugin has maximum time limit of 2 minutes. Plugin running synchronously will get timed out after 2 minutes.
b)      We can configure plugin to run as (another) user's context.
c)      Cannot accept any input parameters, by default it takes only details from the entity using IPluginExecutionContext.

Custom Workflow
a)      Assembly does not have maximum time limit. It is preferred when consuming external webservices in the plugin.
b)      Cannot configure with Run as (another) user's context. 
c)      Can accept input parameters and return  output parameter to workflow. Can be configured to run as a child workflow while plugin does not have this feature.

9.       Whenever you install MSCRM what all databases get created?

10.   Difference Between Append Vs Append To
'Append' and 'Append To' privileges works together. 'Append To' privilege will allow other entities to get attached with the entity. 'Append' privilege will allow the entity to attach the records to the entity with 'Append To' privilege.

Let us understand this with simple example:
Let us say that you want to attach a note to a case then note entity should have 'Append' access right and case entity should have 'Append To' access right. Let us take one more example to understand this. Suppose you have two custom entities called 'TestCustomEntity1' and 'TestCustomEntity2'. You want to attach the 'TestCustomeEntity2' records to 'TestCustomEntity1'records. For this you need to have 'Append' access right on 'TestCustomEntity1' entity and 'Append To' access right on 'TestCustomEntity2'.Now guess will I be able to attach the records? Answer is “NO" because we need to create a 1:N relationship between 'TestCustomEntity1' and 'TestCustomEntity2'. Now the user who has above mentioned access right in his security role will only be able to add 'TestCustomEntity2' records to 'TestCustomEntity1'.

 11.   How to create a Custom Entity record using SDK?
Using Dynamic Entity in CRM 4.0 and Entity in 2011.

12.   How to join two table using Query Expression?
Using Linked entity.

13.   Can we modify the name of Root Business Unit?
No, we will have to re-install MSCRM

14.   Does CRM fall more to sales or marketing in most organizations?
In my experience, marketing is somewhat of a new concept in CRM. Sales are definitely involved, but most often it is operations leading the charge.

15.   How many numbers of tabs available in MS CRM Entity Form?
Officially max 8 tabs, unofficially we can do plenty (It’s not recommended by Microsoft CRM)

16.   Difference between Managed and Unmanaged solutions.
Unmanaged Solutions
All solutions start out as Unmanaged.  When it is in the unmanaged state, you can add, remove, update, and test any of the components of the solution.  You can delete components of your unmanaged solutions, while leaving it available for use in the rest of the system.   Some on the MS CRM Dev team have likened this to your 'source' code of your system.  The great thing about an Unmanaged Solution is that during development, you can create restrictions (like 'not customizable') on the components as they evolve. 

Managed Solutions
When your unmanaged solution is ready for the show, you simply export it to 'Managed'.   You could think of this as 'compiling' you code.   You set the restrictions (i.e. prevent customizations on certain components) and the end user lives by those rules.  But remember, they can still customize the components of the solution that are unrestricted.  You cannot add or remove components of a solution, even if the component is unmanaged.
Once you have packaged the Managed Solution, it can be installed into another organization.  They can also be deployed across multiple deployment types (Online, Partner Hosted, On-Premise) and all CRM Clients (web, Outlook, Mobile Express, and Offline via Outlook Client).
Refer the below links for more information

17.   What is a filtered view?
SQL database views, called "filtered views," are provided with the Microsoft CRM database to enable access to business data according to the user's Microsoft CRM security role. When a user runs a report that obtains data from filtered views, the user's Microsoft CRM security role determines the data to be included in the report. Data in filtered views is restricted at three levels: the organization, the business unit, and the owner. Filtered views exist for all Microsoft CRM business objects (entities).

Your reports should not read data directly from the Microsoft CRM database tables. Instead, use the filtered views. The following sample SQL code returns all columns from the filtered view for an Account entity:          
SELECT * FROM dbo.FilteredAccount

18.   What are different stages used in Plug-In registration?

Stage Name
Stage Number
Stage in the pipeline for plug-ins that are to execute before the main system operation. Plug-ins registered in this stage may execute outside the database transaction.
Stage in the pipeline for plug-ins that are to execute before the main system operation. Plug-ins registered in this stage are executed within the database transaction.
Stage in the pipeline for plug-ins which are to execute after the main operation. Plug-ins registered in this stage are executed within the database transaction.
Stage in the pipeline for plug-ins which are to execute after the main operation. Plug-ins registered in this stage may execute outside the database transaction. This stage only supports Microsoft Dynamics CRM 4.0 based plug-ins.

19.   What are the different kind of Images you will use while registering Plug-In and how they will be used?
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 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.

20.   How you get the data from third party application to your CRM organization?
21.   How you will make sure your CRM application is fast and not having performance issue?

22.   What is POA table and why it is used?
The POA table is used to provide access to specific records for CRM users, and each record in the POA table represents one CRM object that is related to one CRM user.  Records created in the POA table come from one of four ways:

Share reassigned records with original owner:  CRM System Settings
 If this is set to Yes, then records would be added to the POA table whenever an assign takes place.  These records will have a value in the AccessRightsMask column of the POA table.

Direct sharing:  Actions – Sharing
When users explicitly share a record to another user, a record would be created in the POA table.  These records will have a value in the AccessRightsMask column of the POA Table.
Reparent Setting: Relationship Behavior

Each entity has relationships with other entities (ex. Account to Case).  By default, the Reparent option is set to Cascade All.  With this setting, sub records would be shared to the owner of the parent record.  For example:  Let’s say that User1 owns Account1.  User2 has access to Account1 and creates a case underneath Account1.  With the out of the box Reparent options, a record would be created in the POA table that would give User1 access to the newly created case.  These records will have a value in the InheritedAccessRightsMask column of the POA table.

Indirect Sharing:
When sharing occurs through a direct share, assignment, or parenting, if the relationship is set up to cascade the share to child records, additional records will be created in the POA table in order to give proper permissions to the new user for the relevant child records.  These records will have a value in the InheritedAccessRightsMask column of the POA table.

23.   Explain the Sales Flow
24.   What are different activities available in CRM?

a.       Task
b.      PhoneCall
c.       Appointment

d.      Meeting

e.      Email

f.        Letter

g.       Fax

h.      Recurring Appointment
i.         Service Activity

j.        Campaign Response

25.   How can you provide access level as only “None” or “Organization Level”? And what kind of entities are those?
By creating entity Ownership as Organization. Product is one of the CRM out of the box entity with ownership as Organization.

26.   Can we change the color (own required color) to the Bars in the User Charts in the Dashboard?
Yes, We can. Export the chart, modify the XML and then import it.

27.   Workflow Ownership…. And workflow types.

28.   What role do we need to create the solutions and deploy?
29.   Early binding VS Late Binding?
Early Binding
Compiler bind the objects to methods at the compile time. This is called early binding or static binding. Function overloading is example for early binding.

A class should be generated using CrmSvcUtil.exe for generating Entity Classes of CRM.
Late Binding
Compiler bind the objects to methods at the runtime. This is called late binding or dynamic binding. Function overriding is example for late binding.
//Early binding
Account account = new Account();
account.Name = "Via Context";
//Late binding
Entity objEntity = new Entity("account");
objEntity ["name"] = "Via Service";

30.   What is publisher? Prefix and Option value prefix.
Publishers in Dynamics CRM are organizations that develop custom solutions. A publisher can include an organization that makes their own solutions for internal usage or third-party developers who re-sell their solutions. Prior to making changes to Dynamics CRM for the first time, you should edit the default publisher. For most organizations, this one-time edit of the default publisher is all that should be required. If, however, you plan to republish your customizations and provide them to other organizations, then you may want to create a publisher specifically for that purpose. Some larger organizations may wish to create publishers based on different business units or even different individual developers.

Display Name: Change this to a name that describes your organization
Name: This value cannot be changed. For most organizations this will not present a problem.
However, if you plan to make your solutions available to others and you want to create a unique name that aligns better with your company branding, then you will want to create a new publisher for this purpose.

Description: Entering good, descriptive information for the description is always a best practice particularly if you plan to create multiple publishers. A good description might be, “We use this publisher to make internal-facing solutions and customizations to Dynamics CRM; do not use this publisher for solutions that you plan to share with others inside or outside of our organization."
Prefix: This small field is the most important one on the form. It permanently impacts every customization you make to Dynamics CRM using this publisher. Every component (entity, field, and so on) that you create in Dynamics CRM will be prefixed with this value. The value will only show up in views available to administrators and developers. Although this value can be changed later, components created with this value permanently retain it — so select a value that you don’t plan to change. This is usually a three- to five-letter acronym that your organization may be known for. The prefix makes it fairly easy to identify customizations that your team made to Dynamics CRM versus changes that may have been made by others.

Option Value Prefix: These are the first numbers that will be assigned to any new option set values that you create with this publisher. These numbers reduce the chance that duplicate values are created when importing solutions from this publisher that contain option sets. In general, you can leave this number unchanged.

Contact Details: Fill in the contact information for your organization in this section.

31.   How do you debug a plug-in?

32.   How do you debug the Java script?

33.   Ribbon Customization and Adding Button in Ribbon Control?

34.   How many types of Relations can we create between Entities?\

35.   What is N:N Relationship?\

When we create N to N relationship between the entities, CRM internally creates a table with the Primary Keys of two entities and uses the same for the reference.
37.   How you Create N:N Relationship?

38.   A & B are two entities, we created N:N relationship between them? Is system is going to create 1:N and N:1 between both of them automatically?
39.   How you create a security role?

40.   Can I create security Role at Business Unit Level? Not at the Root Business unit.
Yes, we can create it.

41.   What all new feature you know about 2013.

42.   What is the BPF?
43.   What is the Difference between Stage and Step?

44.   How many steps & stages you can create a BPF? Is there any limitations?
45.   What kind of entities you can use while creating BPF?

46.   I have 3 Entities (A, B, C) having relation 1: N, 1: N, 1:N. There is no relation between A & C.  Can I create the BPF by using all these?
47.   Is the BPF works and useful in Real time scenarios? If yes How?

48.   Workflows? Synchronous. How it works?