Microsoft CRM Dynamics Technical And Functional Interview Question and Answer

You cannot export the Default Solution as a Managed Solution, and you cannot deploy a complete Default Solution from Microsoft Dynamics CRM on-premises to Microsoft Dynamics CRM Online or the other way around. You can deploy a custom Solution between two Microsoft Dynamics CRM 2013 systems that use either platform.

Hitachi Interview Question

1.       Explain OOPS concept
OOP Features

Object Oriented Programming (OOP) is a programming model where programs are organized around objects and data rather than action and logic.
 

OOP allows decomposition of a problem into a number of entities called objects and then builds data and functions around these objects.
  1. The software is divided into a number of small units called objects. The data and functions are built around these objects.
  2. The data of the objects can be accessed only by the functions associated with that object.
  3. The functions of one object can access the functions of another object.
OOP has the following important features.

 Class
A class is the core of any modern Object Oriented Programming language such as C#.
In OOP languages it is mandatory to create a class for representing data. 
A class is a blueprint of an object that contains variables for storing data and functions to perform operations on the data. 
A class will not occupy any memory space and hence it is only a logical representation of data.
To create a class, you simply use the keyword "class" followed by the class name:
class Employee
{

}

Object

Objects are the basic run-time entities of an object oriented system. They may represent a person, a place or any item that the program must handle.

"An object is a software bundle of related variable and methods."

"An object is an instance of a class"
  
A class will not occupy any memory space. Hence to work with the data represented by the class you must create a variable for the class, that is called an object. 
When an object is created using the new operator, memory is allocated for the class in the heap, the object is called an instance and its starting address will be stored in the object in stack memory.
When an object is created without the new operator, memory will not be allocated in the heap, in other words an instance will not be created and the object in the stack contains the value null.
When an object contains null, then it is not possible to access the members of the class using that object.

class Employee
{

}
Syntax to create an object of class Employee:

Employee objEmp = new Employee();

All the programming languages supporting Object Oriented Programming will be supporting these three main concepts:
  1. Encapsulation
  2. Inheritance
  3. Polymorphism
Abstraction
Abstraction is "To represent the essential feature without representing the background details."

Abstraction lets you focus on what the object does instead of how it does it.

Abstraction provides you a generalized view of your classes or objects by providing relevant information.

Abstraction is the process of hiding the working style of an object, and showing the information of an object in an understandable manner.

Real-world Example of Abstraction
Suppose you have an object Mobile Phone.

Suppose you have 3 mobile phones as in the following:
 

Nokia 1400 (Features: Calling, SMS)
Nokia 2700 (Features: Calling, SMS, FM Radio, MP3, Camera)
Black Berry (Features:Calling, SMS, FM Radio, MP3, Camera, Video Recording, Reading E-mails)

Abstract information (necessary and common information) for the object "Mobile Phone" is that it makes a call to any number and can send SMS.

So that, for a mobile phone object you will have the abstract class as in the following:
   abstract class MobilePhone
    {
        public void Calling();
        public void SendSMS();
    }

    public class Nokia1400 : MobilePhone
    {
    }

    public class Nokia2700 : MobilePhone
    {
        public void FMRadio();
        public void MP3();
        public void Camera();
    }

    public class BlackBerry : MobilePhone
    {
        public void FMRadio();
        public void MP3();
        public void Camera();
        public void Recording();
        public void ReadAndSendEmails();
    }

Abstraction means putting all the variables and methods in a class that are necessary.
For example: Abstract class and abstract method.
Abstraction is a common thing.
Example
If somebody in your collage tells you to fill in an application form, you will provide your details, like name, address, date of birth, which semester, percentage you have etcetera.
If some doctor gives you an application to fill in the details, you will provide the details, like name, address, date of birth, blood group, height and weight.
See in the preceding example what is in common?
Age, name and address, so you can create a class that consists of the common data. That is called an abstract class. 
That class is not complete and it can be inherited by other classes.

Encapsulation
Wrapping up a data member and a method together into a single unit (in other words class) is called Encapsulation.

Encapsulation is like enclosing in a capsule. That is enclosing the related operations and data related to an object into that object.

Encapsulation is like your bag in which you can keep your pen, book etcetera. It means this is the property of encapsulating members and functions.

    class Bag
    {
        book;
        pen;
        ReadBook();
    }

Encapsulation means hiding the internal details of an object, in other words how an object does something.

Encapsulation prevents clients from seeing its inside view, where the behaviour of the abstraction is implemented.

Encapsulation is a technique used to protect the information in an object from another object.

Hide the data for security such as making the variables private, and expose the property to access the private data that will be public.
So, when you access the property you can validate the data and set it.

Example 1
    class Demo
    {
        private int _mark;

        public int Mark
        {
            get { return _mark; }
            set { if (_mark > 0) _mark = value; else _mark = 0; }
        }
    }

Real-world Example of Encapsulation
Let's use as an example Mobile Phones and Mobile Phone Manufacturers.
Suppose you are a Mobile Phone Manufacturer and you have designed and developed a Mobile Phone design (a class). Now by using machinery you are manufacturing Mobile Phones (objects) for selling, when you sell your Mobile Phone the user only learns how to use the Mobile Phone but not how the Mobile Phone works.

This means that you are creating the class with functions and by with objects (capsules) of which you are making available the functionality of your class by that object and without the interference in the original class.

Example 2
TV operation 
It is encapsulated with a cover and we can operate it with a remote and there is no need to open the TV to change the channel. 
Here everything is private except the remote, so that anyone can access the remote to operate and change the things in the TV.

Inheritance
When a class includes a property of another class it is known as inheritance.
Inheritance is a process of object reusability.
For example, a child includes  the properties of its parents.
    public class ParentClass
    {
        public ParentClass()
        {
            Console.WriteLine("Parent Constructor.");
        }

        public void print()
        {
            Console.WriteLine("I'm a Parent Class.");
        }
    }

    public class ChildClass : ParentClass
    {
        public ChildClass()
        {
            Console.WriteLine("Child Constructor.");
        }

        public static void Main()
        {
            ChildClass child = new ChildClass();

            child.print();
        }
    }

Output
    Parent Constructor.
    Child Constructor.
    I'm a Parent Class.

Polymorphism
Polymorphism means one name, many forms.
One function behaves in different forms.
In other words, "Many forms of a single object is called Polymorphism."

Real-world Example of Polymorphism
Example 1
A teacher behaves students.
A teacher behaves his/her seniors.
Here teacher is an object but the attitude is different in different situations.
Example 2
A person behaves the son in a house at the same time that the person behaves an employee in an office.
Example 3
Your mobile phone, one name but many forms:
  • As phone
  • As camera
  • As mp3 player
  • As radio
To read about Polmorphism in detail click the following link:

Polymorphism in .Net 

The Differences between Abstraction and Encapsulation
Abstraction
Encapsulation
1.  Abstraction solves the problem at the design level.
1. Encapsulation solves the problem in the implementation level.
2. Abstraction hides unwanted data and provides relevant data.
2. Encapsulation means hiding the code and data into a single unit to protect the data from the outside world.
3. Abstraction lets you focus on what the object does instead of how it does it
3. Encapsulation means hiding the internal details or mechanics of how an object does something.
4. Abstraction: Outer layout, used in terms of design.
For example:
An external of a Mobile Phone, like it has a display screen and keypad buttons to dial a number.
 
4. Encapsulation- Inner layout, used in terms of implementation.
For example: the internal details of a Mobile Phone, how the keypad button and display screen are connected with each other using circuits.

 The easier way to understand abstraction and encapsulation is as follows.
Real-world Example
Use an example of a Mobile Phone
You have a Mobile Phone, you can dial a number using keypad buttons. You don't even know how these are working internally. This is called Abstraction. You only have the information that is necessary to dial a number. But not internal working of the mobile.

But how does the Mobile Phone work internally? How are the keypad buttons connected with internal circuit? That is called Encapsulation.
Summary
"Encapsulation is accomplished using classes. Keeping data and methods that access that data into a single unit." 
"Abstraction is accomplished using an Interface. Just giving the abstract information about what it can do without specifying the details."
"Information/Data hiding is accomplished using modifiers by keeping the instance variables private or protected."

2.       Agile Concept
Agile Methods break the product into small incremental builds. These builds are provided in iterations. Each iteration typically lasts from about one to three weeks. Every iteration involves cross functional teams working simultaneously on various areas like planning, requirements analysis, design, coding, unit testing, and acceptance testing.
At the end of the iteration a working product is displayed to the customer and important stakeholders.

3.       ExecuteMultipleRequest crm
A new request called ExecuteMultipleRequest has been added to the Update rollup 12 for the Bulk Data Load. Using this request, multiple request can be executed with the single server call. The main advantage of this request is that it will definitely improve the performance since in one round trip to the server, it actually posts more than 1 message to be executed. With reduced round trips for each individual request the performance improvement is exponential.
ExecuteMultipleRequest accepts the collection of different request and executes each request in a order they appear in the collection. This request will optionally returns the response of each request or error occurred while executing the request. Each message request in the input collection is processed in a separate database transaction.
Members of ExecuteMultipleRequest:
Requests: It is a collection of message requests to execute.
Settings: It contains settings that define whether execution should continue if an error occurs executing a request and if responses for each message request processed are to be returned.
Below is the example, where different requests like Create/Update are added toExecuteMultipleRequest collection and submit it for processing in a single round trip.
                    // Create an ExecuteMultipleRequest object.
                    ExecuteMultipleRequest requestWithResults = new ExecuteMultipleRequest()
                    {
                        // Assign settings that define execution behavior: continue on error, return responses.
                        Settings = new ExecuteMultipleSettings()
                        {
                            ContinueOnError = true,
                            ReturnResponses = true
                        },
                        // Create an empty organization request collection.
                        Requests = new OrganizationRequestCollection()
                    };
                   //create account entity
                   Entity accountEntity=new Entity(“account”);
                   //set name for the account
                   accountEntity.Attributes["name"] = “New Account “+new DateTime();
                   //create CreateRequest object
                   CreateRequest createRequest = new CreateRequest { Target = accountEntity };
                   //add to ExecuteMultipleRequest Collection
                   requestWithResults.Requests.Add(createRequest);
                   //retrieve contact entity
                   Entity contactEntity = _service.Retrieve(“contact”, new Guid(“FC298C3B-2E4F-     E211-9DED-1CC1DE6DAA3E”),                                      new Microsoft.Xrm.Sdk.Query.ColumnSet());
                   //set Business Phone for the contact
                   contactEntity.Attributes["telephone1"]=”1234567″;
                   //create UpdateRequest
                   UpdateRequest updateRequest = new UpdateRequest { Target = contactEntity };
                   //add to ExecuteMultipleRequest Collection
                   requestWithResults.Requests.Add(updateRequest);
                   // Execute all the requests in the request collection using a single web method call.
                   ExecuteMultipleResponse responseWithResults = (ExecuteMultipleResponse)_service.Execute(requestWithResults);
                        if (responseWithResults.IsFaulted)
                        {
                            // Display the results returned in the responses.
                            foreach (var responseItem in responseWithResults.Responses)
                            {
                                // A valid response.
                                if (responseItem.Response != null) { }
                              
                                // An error has occurred.
                                if (responseItem.Fault != null) { }
                             
                            }
                        }
Members of ExecuteMultpleResponse:
1.    IsFaulted: It can be used  to identify if any of the messages submitted failed. Once you have identified an error you can loop through the response item to read the error description per message failure.
2.    Responses: Indicates the collection of responses.
Note: This request will only work on organizations that have UR12 applied or on Online organizations that have been upgraded to Polaris.

4.       Addonchange in javascript
There are three methods you can use to work with the OnChange event for an attribute:
Sets a function to be called when the attribute value is changed.
JScript
Xrm.Page.getAttribute(arg).addOnChange([function reference])
Parameter
Type: function pointer
Remarks: The function will be added to the bottom of the event handler pipeline. The execution context is automatically set to be the first parameter passed to the event handler. See Execution context (client-side reference) for more information.
Example:In this example, the JScript library contains two functions. Adding the addMessageToOnChange function to the form OnLoad event will add the displayMessage function as a handler for the OnChange event for the first attribute in the form.
JScript
function addMessageToOnChange()
{
   Xrm.Page.data.entity.attributes.get(0).addOnChange(displayOrgName);
}
function displayOrgName(execContext)
{
   Xrm.Utility.alertDialog(execContext.getContext().getOrgUniqueName());
}
Removes a function from the OnChange event hander for an attribute.
JScript
Xrm.Page.getAttribute(arg).removeOnChange([function reference])
Parameter
Type: function reference
Example: In this example, the JScript library contains two functions. Adding the removeMessageFromOnChange function to another form event will remove the displayOrgName function as a handler for the OnChange event for the first attribute on the form.
JScript
function removeMessageFromOnChange()
{
   Xrm.Page.data.entity.attributes.get(0).removeOnChange(displayOrgName);
}
function displayOrgName(execContext)
{
   Xrm.Utility.alertDialog(execContext.getContext().getOrgUniqueName());
}
Causes the OnChange event to occur on the attribute so that any script associated to that event can execute.
Attribute Types: All
JScript
Xrm.Page.getAttribute(arg).fireOnChange()

5.       Iframe error this page can’t be displayed
Uncheck Restrict cross-frame scripting
Use the Restrict cross-frame scripting, where supported option when you don’t fully trust the content displayed in an IFRAME. When this option is selected, the IFRAME has the attributes set that are listed in the following table.
6.       Marketinglist list in plugin

7.       Explain Xrm object model
In addition to triggering code to run after specific events occur, Microsoft Dynamics CRM provides an object model of form elements that can be utilized to manipulate data, change form object properties, or analyze the current state of the form or data within the form. This object model is called Xrm.Page and in addition to the event handlers are the primary tool used to develop custom business logic at the client-side.
Some benefits of using the Xrm.Page model are:
1.    Change the appearance or manipulate form objects like data controls (text boxes, checkboxes, etc.), tabs, sections, etc.
2.    Identify elements to show/hide.
3.    Specify names of objects from which to retrieve/store data values.
4.    Provide namespaces to properties so the system allows multiple controls per field or multiple forms per entity.
The Xrm.Page model provides a namespace container for following objects:

Context

Context provides methods to retrieve information specific to an organization, a user, or parameters that were passed to the form in a query string by event handler registered on Form.
The context object is used in forms by using the Xrm.Page.context syntax. There are several functions that are accessible through the context object, such as getUserId. The following code will return the current user’s UserId.
Xrm.Page.context.getUserId();

Data

Data provides access to the data on Entity Form. Values can get or set fields on CRM form after data validation or data manipulation.
The following code will return the value of the email address field:
Xrm.Page.data.entity.attributes.get(“emailaddress1”);
Or,  a shortcut for this code is:
Xrm.Page.getAttribute(“emailaddress1”);
The following code will set the value of the email address field:
Xrm.Page.getAttribute(“emailaddress1”).setValue(“joecrm@powerobjects.com”);

UI

UI provides methods to retrieve information about the user interface, collections for several sub components of the form. It provides access to each control present on the form.
The following code will close the current form:
Xrm.Page.ui.close();
This code will get the value of the associated label of the email address field.
Xrm.Page.ui.controls.get(“emailaddress1”).getLabel();

8.       Isofflineplayback property in crm
Gets a value indicating if the plug-in is executing as a result of the Microsoft Dynamics CRM for Microsoft Office Outlook with Offline Access client transitioning from offline to online and synchronizing with the Microsoft Dynamics CRM server.

true if the the plug-in is executing as a result of the Microsoft Dynamics CRM for Microsoft Office Outlook with Offline Access client transitioning from offline to online; otherwise, false.
9.       Explain ipluginexecutioncontext

Defines the contextual information passed to a plug-in at run-time. Contains information that describes the run-time environment that the plug-in is executing in, information related to the execution pipeline, and entity business information.
Namespace:   Microsoft.Xrm.Sdk
Assembly:  Microsoft.Xrm.Sdk (in Microsoft.Xrm.Sdk.dll)

Syntax

C#
public interface IPluginExecutionContext : IExecutionContext

Properties

Name
Description
Gets the GUIDGUID of the business unit that the user making the request, also known as the calling user, belongs to.(Inherited from IExecutionContext.)
Gets the GUID for tracking plug-in or custom workflow activity execution. (Inherited from IExecutionContext.)
Gets the current depth of execution in the call stack.(Inherited from IExecutionContext.)
Gets the GUID of the system user account under which the current pipeline is executing.(Inherited fromIExecutionContext.)
Gets the parameters of the request message that triggered the event that caused the plug-in to execute.(Inherited from IExecutionContext.)
Gets whether the plug-in is executing from the Microsoft Dynamics CRM for Microsoft Office Outlook with Offline Access client while it is offline. (Inherited from IExecutionContext.)
Gets a value indicating if the plug-in is executing within the database transaction.(Inherited fromIExecutionContext.)
Gets a value indicating if the plug-in is executing as a result of the Microsoft Dynamics CRM for Microsoft Office Outlook with Offline Access client transitioning from offline to online and synchronizing with the Microsoft Dynamics CRM server.(Inherited from IExecutionContext.)
Gets a value indicating if the plug-in is executing in the sandbox.(Inherited from IExecutionContext.)
Gets the name of the Web service message that is being processed by the event execution pipeline.(Inherited from IExecutionContext.)
Gets the mode of plug-in execution.(Inherited from IExecutionContext.)
Gets the date and time that the related System Job was created.(Inherited from IExecutionContext.)
Gets the GUID of the related System Job.(Inherited from IExecutionContext.)
Gets the GUID of the organization that the entity belongs to and the plug-in executes under.(Inherited fromIExecutionContext.)
Gets the unique name of the organization that the entity currently being processed belongs to and the plug-in executes under.(Inherited from IExecutionContext.)
Gets the parameters of the response message after the core platform operation has completed.(Inherited from IExecutionContext.)
Gets a reference to the related SdkMessageProcessingingStep or ServiceEndpoint.(Inherited fromIExecutionContext.)
Gets the execution context from the parent pipeline operation.
Gets the properties of the primary entity after the core platform operation has been completed.(Inherited from IExecutionContext.)
Gets the properties of the primary entity before the core platform operation has begins.(Inherited fromIExecutionContext.)
Gets the GUID of the primary entity for which the pipeline is processing events.(Inherited fromIExecutionContext.)
Gets the name of the primary entity for which the pipeline is processing events.(Inherited fromIExecutionContext.)
Gets the GUID of the request being processed by the event execution pipeline.(Inherited fromIExecutionContext.)
Gets the name of the secondary entity that has a relationship with the primary entity.(Inherited fromIExecutionContext.)
Gets the custom properties that are shared between plug-ins.(Inherited from IExecutionContext.)
Gets the stage in the execution pipeline that a synchronous plug-in is registered for.
Gets the GUID of the system user for whom the plug-in invokes web service methods on behalf of.(Inherited from IExecutionContext.)

Remarks

The execution context is passed to a plug-in at run time in the System.IServiceProvider parameter of the Execute method. You can obtain the context from the service provider as shown in the following plug-in code.
C#
 
 
// Obtain the execution context from the service provider.
IPluginExecutionContext context = (IPluginExecutionContext)
    serviceProvider.GetService(typeof(IPluginExecutionContext));


1Ways of Navigation customization crm
XRM Toolbox Sitemap Editor
Export solution.modify XML and then import the solution

Comments

Popular posts from this blog

Tips 01) self introduction in an interview

Computer Science Terminology

Why Failure Is Good for Success