Search This Blog

Friday, September 30, 2022

How To Deal With this Dynamics 365 Plugin Interview Question?

Whenever you face this situation, that the plugin only fails in the production region but not in the development or User Acceptance Test (UAT) environment, then the first and foremost thing you can do is to observe the behavior of the Plugin carefully in production aka. plugin black-box testing.

Now the obvious query comes to your mind is, that what the hell is Black-Box testing?

In nutshell, Black-box testing means we try to observer the behavior and symptoms of the system without having actual technical / coding information in hand.

Now, What Can we do about this Dynamics 365 Plugin situation?

So when you observe the plugin behavior carefully on production then, you can see either of below two outcomes.

  • Firstly, the plugin will not throw any error on screen but at the same time, it will not perform the required job for which it was written in the first place.
  • or Secondly, the plugin will immediately throw an error the moment the action is taken on which that plugin is registered.

1) So if the plugin is not throwing any error on screen but at the same time, it is not performing the required job, then the possible root cause for that might are mentioned below.

  • Firstly, it might happen that the Plugin itself is not triggering. Then Compare the Plugin Configuration on Production with the development / UAT environment. And make sure that plugin is triggering
    • Check the Message.
    • Filtering Attributes if any
    • Run in User’s Context
    • Stage
    • Synchronous / Asynchronous Execution Mode
    • Unsecure/Secure Configurations ( Secure Configurations has to be reconfigured manually. Check this article for details)
    • If applicable, verify the POST/PRE Images and attributes.
    • Lastly, debug the plugin and make sure that it is triggering in the first place.
  • Secondly, the Plugin might be triggering but going out of the code due to some null check conditions in code. Make to verify below items to solve this
    • Check the Plugin Code, for all null checks in your plugin. And try to see if it’s not moving out due to that. If so create required data on the production environment.
  • Thirdly, the plugin might be triggering but due to validations in the depth condition, it is moving out.
    • If any other plugin/workflow is triggering the plugin in context. If so handle the depth check condition properly
  • Lastly, some plugin configuration or coding condition check issues due to which it is not executing the required code portion.

2) If the plugin is immediately throwing an error the moment the action is taken, then the possible root cause for that might are mentioned below.

  • The error can occur due to plugin misconfiguration
  • Required Customizations/permissions are not present in Production/other environments to calling users.
  • Directly reading the EntityCollection.FirstOrDefault, without checking if the returned EntityCollection object is null or not.
  • Reading some configuration records, that are not yet created in Production/Other Instances Code logic/erroneous code issues.

Conclusion

Whenever you end up in such situations, then there are very high chances that you might have missed / improper plugin configuration on production. Which you can overcome by carefully observing the behavior of the plugin on the production environment.

At the same time, if you face such a situational interview question in your Dynamics 365 or CRM job interview then now you know to face it.

So, I hope that you might have found this article and video useful and learned some useful tips from it. If so then, kindly share this article with your friends and colleagues. Also, share your feedback and If you still have any doubt or confusion then please put them in the comments below.

Or if you feel that, I have missed some points that you have faced then we highly encourage you to share with us and our audience. I love to hear back from you and you can also share your feedback about this article as well.

So on that note, I take your leave and thank you for reading this article till the end. Hope to see you all in the next article till then bye bye and take a very good care of yourself and your friends and family.


Advanced MS Dynamics CRM Interview Questions For Experienced

 MS Dynamics CRM Interview Questions – If you are looking for Microsoft Dynamics CRM Interview Questions, then you are at right place. This blog post will help you to explore 100+ dynamics crm interview questions for experienced and freshers. This list of questions will help you to crack your next ms dynamics job interview. Happy reading.!

Microsoft Dynamics CRM Interview Questions

Microsoft Dynamics CRM General Interview Questions – This section includes interview questions from services, field, form security, auditing, etc.

Easy Microsoft Dynamics CRM Interview Questions

What are the services available in CRM 2016?
What is the main difference between CRM 4.0 and CRM2016 services?
Any idea on current version of CRM?

Medium Microsoft Dynamics CRM Interview Questions

What is Discovery service and purpose of it?
What are the REST calls in CRM?
What is early binding and late binding. How is it used in CRM?
What is PrinciplalObjectAccess table why is it used?
What is the use of stringmap table?

Advanced Microsoft Dynamics CRM Interview Questions

What are the different types of Authentication methods supported in Dynamics CRM
What are different types of Modules we have in CRM?
Can you explain the Marketing Life cycle in CRM?
Can you brief on Sales module of CRM?
How the service module works in CRM?
Explain details about “Event Execution Pipeline”
What is field level security?
What is form level security?
Can we control the field level security based on security role?
Can we control the entities in site map with security roles?
Will auditing slow down my system?
Does audit data count against my CRM storage quota?
Can I audit just changes done by a couple users?
Can I schedule auditing to be turned off during data import?
What type of operations and data can be audited in CRM?

Dynamics CRM Field Level Security Interview Questions

Easy MS Dynamics CRM Interview Questions

What is the importance of field level security in CRM?
What are the permission we can restrict on specific field with field level security?
What are the high level steps to enable field level security?
What will happen if a field is enabled for field level security?
What a field level security profile contains in CRM?
Can we add user/team to more than one field level security profile?
Can we delete System Administrator field level security profile?
Can we set field level security for OOB fields?
Do Audit history maintained for enabling and disabling field level security by setting “IsSecured” on a field?
What will happen if the user don’t have “Read” security on a field?

Medium MS Dynamics CRM Interview Questions

How can we know what are all attributes can be secured in CRM with field level security?
Do all attribute data types support to restrict all permissions with field level security?
Which security roles allow you to see secured fields?
What will happen if multiple profiles assigned to user/team?

Advanced MS Dynamics CRM Interview Questions

How do secured fields behave for create or update?
How do secured fields behave for Retrieve and RetrieveMultiple?
How do secured fields behave when records are shared?
How do secured fields behave for filtered views?
How do secured fields behave for offline synchronization?

MS Dynamics CRM Customizations Interview Questions

This section included interview questions from Entity, field, form, view, Ribbon, dashboard.

Dynamics CRM Easy Interview Questions

Can we modify the name of root business unit?
Can we have 2 BU’s for a single user?
Can we add different BU related users to a single Team?
Where we need to change the prefix for custom components?
How to see the CRM version information?
Where can we set the Default module and Entity to get on opening CRM?
Where to do the user related (personal) settings?
Where to change the #of records count limit that displaying in entity grid view?
What is the maximum limit of records can be displayed in CRM grid view?
Where can we change the number, currency and time formats?
What are the different data types we have in CRM?
Can we create a new field from form customization?
What is the max chars limit for “Multiline textbox”?
What is the lookup data type and where it will be placed?
What is the char limit for custom components pre-fix?
Where does CRM store Option Set values in SQL Server?
What are requirement levels we have to create a new field for an entity?
What are the default settings for Field level security and Auditing?
How can you customize the CRM Ribbon?
Where can we get Organization and Discovery service URLs in CRM instance?

Medium Dynamics CRM Interview Questions

How many types of relationships are available in crm?
What are the “Relationship behaviors” in CRM and explain each of them?
Where the Option set field options are stored in CRM?
How can you add Custom buttons to Ribbon?
How can you Hide system ribbon buttons?
How can you override system ribbon button functionality?
Is there any way to get Intelligence for Ribbon customizations in VS? If yes, how?
What are filtered views?
What is the importance of Application Ribbon component in CRM?
What is the importance of Site map in CRM?
What are the different types of forms we can create in CRM 2015?
What are the limitations of Quick create form w.r.t controls and design?
What are the limitations of Quick view for w.r.t. controls and design?
What are the different web resource supported by CRM?
Can we enable/disable the plug-in steps from CRM solution?
What are the different types of views we have in CRM?
How can we create a custom activity in CRM?
What are the different changes you observer between custom entity and custom activity?
What will happen if we set “Searchable” as “No” for a field from customizations?

Advanced Dynamics CRM Interview Questions

What is the difference when the ownership is user vs organizaion for a custom entity?
What are the types of Ribbons we have in CRM 2011?
What will at backend on creation of new custom entity in CRM?
What are the different type of N: N relationships we have in CRM?
What are the options we can’t rollback if we enable them while creating custom entity?
What are the options we can rollback if we enable them while creating custom entity?
What are the settings we need to do to see the entity relations from Advanced find?
What is the importance of “Manager Properties” on CRM components?

Microsoft Dynamics CRM Scenario Based Interview Questions

When we should go with Global option sets?
What is the importance of Manual N:N relationship? Can you explain with a simple scenario?
When we can use multiple forms? Can you explain in detail?

Solutions MS CRM Interview Questions

Easy MS CRM Interview Questions

What are types of solutions in CRM 2011?
Can we export Default solution as “Managed Solution”?
What is Managed Solution?
What is unmanaged solution?
Can we update the components in Managed solution?
What is the process to update Managed solution?
How can we know the Owner of Managed solution?

Medium MS CRM Interview Questions

What are components we can add from solutions?
What is meant by web resources and how many types of web resources we have?

Advanced MS CRM Interview Questions

What are the minimum privileges required to create solution?
Read write of Customizations
Read write of solutions
Read write of publishers
Read write of web resources
Import and Export customizations
Publish customizations
What is meant by Managed Properties?
What is meant by publisher and why we are using it in CRM 2016?

CRM Interview Questions

Difference Interview Questions on Microsoft Dynamics CRM

Discovery service Vs Organization service
Managed Solution Vs Unmanaged Solution
Plug-in Vs Workflow
Workflow Vs Dialogue
Sync Vs Async Plug-ins
Global Option set Vs Normal Option set field in CRM
Append Vs AppendTo
Share Vs Assign
Organization owned entities Vs User Owned entities

Advanced CRM Interview Questions

Query Expression Vs Fetch XML query
Query Expression Vs Query by Attribute
Form level security Vs Field level security
Pre-Image Vs Post Image in Plug-ins
Plugin deployment: Difference between GAC, DataBase, Disk deployments.
SQL based Vs Fetch XML based SSRS reports

Async Plug-in Vs Custom Workflow
Pre-Validation step Vs Pre-Operation step
Secure configuration Vs Unsecure Configurations in Plugin

Dynamics CRM Interview Questions

Microsoft Dynamics CRM Plug-ins Interview Questions.

What is the process to develop the Plug-in?
What is the process to register the Plug-in in CRM?
What are stages we have in CRM?
What is the namespace for IPlugin Interface? (Xrm.Sdk)
What is the method we need implement from IPlugin interface?

Do we have all attributes on the form in “Target” attribute of Input parameters in CRM?
Which type of plug-ins contains “Output Parameters”
When can infinite loop occur in a plugin? How do you avoid infinite loops in plugin code?
Different fields in context object
When we can go for pre-validations and when we can go for pre-stage?
At what events “Images” are not available
What is the advantage of adding “Pre or Post” images to a plug-in

How can you debug the Plug-in code?
What is plug-in profiler and importance of it?
What is the secured configurations and how can we access from plug-in code?
What is the unsecured configurations and how can we access from plug-in code?
What are the minimum privileges a user should have to register a plug-in in CRM?
What are different methods of Plug-in storage?

MS Dynamics CRM Workflows Interview Questions

What is the process of creating sample UI workflow?
How can we create Timeout conditions in workflow?
Difference between Timeout and Wait conditions?
What is the importance of scope option in workflow?
What is CorrelationToken in workflows and importance of it?
Generally, workflows are getting failed after 8 iterations. Is there any way to overcome this?

MS Dynamics CRM Security Interview Questions

Explain the difference between Append & Append To?
Can you explain the difference between Share and Assign?
What are the different access levels we have in CRM?
What are the different types of privileges we have in CRM?
What is the default role assigned to user if it created from OOB import tool?
Which roles will get access by default on creation of custom entity?
Can we export child business unit security roles?
What are the minimum privileges required to track the outlook appointments into CRM?
User wants add notes to an account record. Which privileges he should have on account and notes?

References:

Microsoft Dynamics Community

https://crmtipsbyprm.wordpress.com

https://xrm.com/crmonline/FAQ/Microsoft-Dynamics-CRM-Online-FAQ/


Using “PreEntityImage” and “PostEntityImage” in Workflows

As we all know that we can always read Pre image and Post image in the plug-in for various purpose. However, in workflow, we may sometimes want to read Pre Image for some purpose. Now we can also read Pre Images and Post Images in the workflow using Execution Context. It uses the same Plug-in Architecture and hence we can use it to read Pre Images and Post Images. However, this concept is not documented in the SDK so it might be unsupported.

The purpose could be to read the previous values from the entity record. For e.g. We may require it for Rollup Calculations in the Update operations since we need to see what the previous value in the Entity Record was and according to it we can perform some action on the same. For instance there is a field named as “No. of contacts” on the Account, which maintains the number of sub contacts associated with the account, so when we write a workflow on update of contact (Parent Account) field, we need to read the Pre Image to update Old Account record field and Post Image to update new account field.

To read pre entity image you can read it like below:
Entity contractedProductPreImage = context.PreEntityImages[“PreBusinessEntity“];
To read Post Entity Image you can read it like below:
Entity contractedProductPostImage = context.PreEntityImages[“PostBusinessEntity“];

Here, names such as “PreBusinessEntity” and “PostBusinessEntity” are used to read the Pre and Post Images.

At times, it may not required to read Post Image from context as we can read the updated entity record by retrieving its data from the organization service or from the Input Parameters. In order to get the Previous Entity Record Values, the only option to get it is to read it from the Pre Image.

The availability of Pre Image and Post image also depends on the events. As we know, workflows can also works in Synchronous mode i.e. Real Time Workflow. Below is the table that tells us when we can read Pre Image and Post image during different events and in different scenarios:

EventsPre-ImagePost-Image
Background Workflow
CreateNOYES
UpdateYESYES
DeleteYESNO
On-DemandYESNO
Real-Time Workflow
Create-AfterNOYES
Update-BeforeYESNO
Update-AfterYESYES
Delete-BeforeYESNO
On-DemandNONO

Conclusion:

We can read the Pre and Post entity images in the workflow depending on Synchronous/Asynchronous Workflow and its events.


Pre-Image and Post-Image in Dynamics CRM

 image

 What is Pre and Post Images in CRM?

 In Real Life,

 Let's understand the Images in CRM by taking one real-life example of ATM Withdrawal Process:

 

Suppose, I have 10,000 Rs in my bank account. So this amount would be the Pre-Image of my account balance. Now, If I withdraw 5000 Rs from my account, then the remaining amount left in my account would be 5000 Rs. So the current amount left in my account would be the Post-Image of my account balance.

 

Here

 

image

Pre-Image of my Account Balance = 10,000 Rs

image

Performing Database Transaction

image

Transaction Done (Core Operation) of 5000Rs

image

Post-Image of my Account Balance = 5000 Rs

 

In CRM,

  • Images are the snapshots of the entity's attributes, before and after the core system operation. 
  • PreEntityImages contain snapshots of the primary entity's attributes before the core platform operation perform and PostEntityImages contains the snapshot of the primary entity's attributes after the core platform operation performed.

Let say: I have a contact record in the CRM with FirstName and LastName as Arpit and Shrivastava respectively. Suppose I change the values of both the field as Mike and Hussey respectively. Then the  Pre-Image of FirstName and LastName would be Arpit and Shrivastava respectively while the Post-Image of FirstName and LastName would get Mike and Hussey respectively.

Difference between Plugin Context and Plugin Images? 

 Context means Current.

 Context contains the entity business information which is being updated currently on CRM Platform.

In Plugin,

IPluginExecutionContext contains information that describes the run-time environment that the plug-in executes, information related to the execution pipeline, and entity business information.

When a system event is fired that a plug-in is registered for, the system creates and populates the context and passes it to a plug-in through the previously mentioned classes and methods. The execution context is passed to each registered plug-in in the pipeline when they are executed.

Context Example - 

Let say. I have a plugin registered on Update of Contact Entity, If I update only Firstname and Lastname of contact record then plugin code can get only Firstname and Lastname field's value from the Plugin Context along with the information related to the execution pipeline.

But If I want to get the other field's value like emailaddress and account name from plugin context, we will not be able to get the same and will get the error 'The given key was not present in the dictionary' error.

To get these values, either we will have to perform retrieve query or can achieve it through pre-images.

So Images are the best ways to get the copy of data (from whatever fields you want) before and after changes made to the database or changes committed to the database. While from context we can get the updated field's values only

Advantages of using Pre-Image and Post-Image in CRM?

 

One of the best uses for this is in update plug-ins. 

  • In update plug-in, target entity only contains the updated attributes. However, often the plug-in will require information from other attributes as well. Instead of issuing a retrieve, the best practice is to push the required data in an image instead.

For Example- I have a plugin trigger on Update of Account's email address and website fields. 

Logic is if any user updates the account's email address and website URL then, create a task with the updated email address and website URL along with account name and its parent account.

To implement this logic in my plugin, I can get account's email address and website URL from Context while account name and parent account.not. Because the user has updated only account's email address and website URL not rest of the account's data. So Plugin Context contains only updated information instead of unchanged information.

So how would I get the account's account name, parent account or any other data?

Option 1- Perform Retrieve Query to get rest of account information.

Option 2- Use Pre-Image and configure the fields from which we want to pull the information without performing any query on the database.

 Comparison of data before and after. This allows for various audit-type plugins, that logs what the value was before and after, or calculating the time spent in a stage or status.

 

When are the different images available in the event execution pipeline? 

 

image

 Plugin Image Example:

 

Let understand the plugin code by taking a very simple example- 

 

Whenever a user updates the emailaddress and topic(subject) on the Lead entity, we want to get the old and new value respectively of the topic field before and after the changes made in the database. And update both the values in the description field.

 

So here, the old value of topic field would be called as pre-image and the new value of topic field would be called as post image.

 

Register a Plugin on Update of Lead 'Email Address' Field.

 

image

 

Register a new Image on Update Step

 

image

  

Select 'Topic' from the Field List. Because we want to get the Pre and Post Image of Topic Field.

 

image

 

Give Image name and check PreImage and PostImage checkbox

 

You can specify to have the platform populate these PreEntityImages and PostEntityImages properties when you register your plug-in. The entity alias value you specify during plug-in registration is used as the key into the image collection in your plug-in code

image

using Microsoft.Xrm.Sdk;

using Microsoft.Xrm.Sdk.Query;

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;


namespace PluginImageExample
{

 public class LeadUpdate : IPlugin

  {

    public void Execute(IServiceProvider serviceProvider)

    {

    // Extract the tracing service for use in debugging sandboxed plug-ins.

    ITracingService tracingService =

    (ITracingService)serviceProvider.GetService(typeof(ITracingService));


    // Obtain the execution context from the service provider.

    IPluginExecutionContext context = 
    (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
   // Obtain the organization service factory.
   
    IOrganizationServiceFactory serviceFactory = 

    (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));

    
    // Obtain the organization service.    
    IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);


    if (context.InputParameters.Contains("Target") && 

                  context.InputParameters["Target"] is Entity)

     {

        // Obtain the target entity from the input parameters.

         Entity entity = (Entity)context.InputParameters["Target"];

        // User is updating only email address in lead form so we will get only 
           emailaddress from the context not lead's description.To get description
           orsubject field we will use plugin images
        // get the lead email from context.

         string email = entity["emailaddress1"].ToString();

        // get the current record guid from context

         Guid leadRecordGuid = entity.Id;
  // Define variables to store Preimage and Postimage  string pretopic = string.Empty; string posttopic = string.Empty; 

        // in below leadimage has been added in plugin registration tool

        // get PreImage from Context

          if (context.PreEntityImages.Contains("LeadTopicImage") && context.PreEntityImages["LeadTopicImage"] is Entity)
          {

                Entity preMessageImage = (Entity)context.PreEntityImages["LeadTopicImage"];
               // get topic field value before database update perform
                pretopic = (String)preMessageImage.Attributes["subject"]; 

}



// get PostImage from Context
            if (context.PostEntityImages.Contains("LeadTopicImage") && 
                   context.PostEntityImages["LeadTopicImage"] is Entity)

            {

              Entity postMessageImage = (Entity)context.PostEntityImages["LeadTopicImage"];

              // get topic field value after database update performed
             posttopic = (String)postMessageImage.Attributes["subject"]; 

}


// update the old and new values of topic field
in description field

          Entity leadObj = 
          service.Retrieve(context.PrimaryEntityName,leadRecordGuid, new ColumnSet("description"));

          leadObj["description"] = 
          "Pre-Image of description- "+pretopic+"   "+"Post-Image of description-- "+posttopic;

          service.Update(leadObj);

           }

        }

    }

}


Let's test the functionality. Open any existing Lead record.

 

image




Update Email and Topic field's value and Save the record.

 

image


Check the 'Description' field. It has been updated with old and new value both of Topic Field.

 

image

 

Points to Note:

                                                                      image

  • Microsoft Dynamics 365 populates the pre-entity and post-entity images based on the security privileges of the impersonated system user. Only entity attributes that are set to a value or are null are available in the pre or post entity images. 
  • There are some events where images aren’t available. For example, only synchronous post-event and asynchronous registered plug-ins have PostEntityImages populated. The create operation doesn’t support a pre-image and a delete operation doesn’t support a post-image.
  • Registering for pre or post images to access entity attribute values results in improved plug-in performance as compared to obtaining entity attributes in plug-in code through RetrieveRequest or RetrieveMultipleRequest requests.
  • A pre-image passed in the execution context to a plug-in or custom workflow activity might contain data that the logged-on user doesn't have the privileges to access. Microsoft Dynamics 365 administrators and other users with high-level permissions can register plug-ins to run under the “system” user account or plug-in code can make calls as a “system” user on behalf of the logged-on user. If this happens, logged-on users can access data that their field level security does not allow access to.
  • Context contains only updated field's value information of any record. While the Pre-Image contains all the field's values information (depends on what field you are being opted to be available as pre-images)