CRM Notes

Contents

MS Dynamics. 2

Plugin.. 3

Plugin Execution Pipeline. 3

Event execution pipeline. 3

Entity Moniker. 5

The advantages of deploying your plugin to the database. 5

Writing Plugin Using Developer ToolKit. 6

Writing Plugin Using Plugin Registration tool 9

Activate Deactivate Child Record based on Parent Record State Change. 13

Duplicate Detection.. 15

Actions (TBA). 16

Microsoft Dynamics 365 Workflows. 16

Scope of Workflow: 16

Execution Context of Workflow: 17

Custom Workflow… 17

Rollup Field.. 20

Currency Fields. 23

Access Team… 23

Sharing VS Access Team Model 25

PrincipalObjectAccess. 25

Services. 26

Organization Service. 26

Organization Data Service. 26

Web API. 27

Entity. 27

Entity Ownership.. 27

Server Config. 27

Concerning Active directory. 28

MS CRM Database. 28

MSCRM_CONFIG.. 29

MS CRM Architecture. 29

Metadata Driven Architecture. 29

Multitier architecture. 30

Activity Pointer. 31

Common Data Model 31

MS CRM Topics to Learn.. 32

Authentication Mechanism in MS CRM… 32

Team… 33

Managing Users. 34

Create or edit an app.. 35

Create an app.. 35

New Button CRM 2011.. 37

MS CRM 365: Adding javascript. 41

IFrame in CRM 2011.. 44

Creating Early Bound Classes. 46

CRM2011: Console Application.. 48

SSIS Integration.. 48

SSIS Package. 50

Interview Questions. 55

executionContext : 55

XRM Object. 55

DLL Extrection.. 56

Important classes. 56

MS Dynamics

Plugin

Dynamics 365 Plugin is custom business logic (code) that you can integrate with Microsoft Dynamics 365 (online & on-premises) to modify or augment the standard behavior of the platform. Another way to think about plugins is that they are handlers for events fired by Microsoft Dynamics 365. You can subscribe, or register, a plugin to a known set of events to have your code run when the event occurs.

Dynamics 365 Plugin: PreImage and PostImage
If you followed this post, we used PreImage and PostImage on our second scenario so we have to add PreImage and PostImage on our assembly. If you did not use any of these on your plugin, it is not required to add PreImage and PostImage.

1. Right click on the (STEP) under “PostOperationcontactUpdate” assembly > Register New Image. Ensure that Pre Image is only selected. Name: PreImage Entity Alias: PreImage. For Post Image, ensure that Post Image is the only selected. Name: PostImage Entity Alias: PostImage.

Plugin Execution Pipeline

Event execution pipeline

The Microsoft Dynamics CRM event processing subsystem executes plug-ins based on a message pipeline execution model. A user action in the Microsoft Dynamics CRM Web application or an SDK method call by a plug-in or other application results in a message being sent to the organization Web service. The message contains business entity information and core operation information. The message is passed through the event execution pipeline where it can be read or modified by the platform core operation and any registered plug-ins.

Note: While there are several Web services hosted by the Microsoft Dynamics CRM platform, only events triggered by the organization and OData endpoints can cause plug-ins to execute.

message pipeline execution model:

Description: Plugin Architecture
  1. The event execution pipeline processes events either synchronously or asynchronously.
  2. The platform core operation and any plug-ins registered for synchronous execution are executed immediately.
  3. Synchronous plug-ins that are registered for the event are executed in a well-defined order.
  4. Plug-ins registered for asynchronous execution are queued by the Asynchronous Queue Agent and executed at a later time by the asynchronous service.
  5. Regardless of whether a plug-in executes synchronously or asynchronously, there is a 2 minute time limit imposed on the execution of a (message) request. If the execution of your plug-in logic exceeds the time limit, a System.TimeoutException is thrown. If a plug-in needs more processing time than the 2 minute time limit, consider using a workflow or other background process to accomplish the intended task.
  6. The event execution pipeline processes events either synchronously or asynchronously.
  7. The platform core operation and any plug-ins registered for synchronous execution are executed immediately.
  8. Synchronous plug-ins that are registered for the event are executed in a well-defined order.
  9. Plug-ins registered for asynchronous execution are queued by the Asynchronous Queue Agent and executed at a later time by the asynchronous service.
  10. Regardless of whether a plug-in executes synchronously or asynchronously, there is a 2 minute time limit imposed on the execution of a (message) request. If the execution of your plug-in logic exceeds the time limit, a System.TimeoutException is thrown. If a plug-in needs more processing time than the 2 minute time limit, consider
Description: https://arunpotti.files.wordpress.com/2014/10/stages.png

https://docs.microsoft.com/en-us/previous-versions/dynamicscrm-2016/developers-guide/gg309673(v=crm.8)?redirectedfrom=MSDN

When a plug-in is run in response to an execution pipeline event for which it is registered, the plug-in’s Execute method is called. That method passes an IServiceProvider object as a parameter, which contains a number of useful objects. 

IPluginExectionContext

  1. 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.
  2. 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. // Obtain the execution context from the service provider.

IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof( IPluginExecutionContext));

IOrganizationService Interface: Provides programmatic access to the metadata and data for an organization.

Entity Moniker:

A moniker holds only the guid and the entity name. The EntityMoniker type was replace by EntityReference.

I created a plugin for the SetStateDynamicEntity which got triggered.

Anyway the next curious thing is on a setState plugin the usual Entity object is not passed in and instead you get “EntityMoniker” which holds an EntityReference, State and Status.

The advantages of deploying your plugin to the database

  1. The plugin is backed up when the database is backed up
  2. For multiple server configurations you only need to deploy once to the database and not individually to each CRM server.
  3. Plugins in the database can be added to solutions, Disk, GAC plugins cannot
  4. Plugins deployed to the GAC or Disk will need an IISRESET to refresh, plugins deployed in the database do not.
  5. Sandboxed and CRM Online plugins have to be deployed in the database

Writing Plugin Using Developer ToolKit

Right click Solution> add new project >select  CRM Pacakage

Add a reference of your custom plugin to the CRM packaging project, just right click References –> Add Reference

protected void ExecutePostEmployeeUpdateCompanyTotalSal(LocalPluginContext localContext)

        {

            if (localContext == null)

            {

                throw new ArgumentNullException(“localContext”);

            }

            IOrganizationService service = localContext.OrganizationService;

            IPluginExecutionContext context = localContext.PluginExecutionContext;

            ITracingService tracingService = localContext.TracingService;

            Entity postImageEntity = (context.PostEntityImages != null && context.PostEntityImages.Contains(this.postImageAlias)) ? context.PostEntityImages[this.postImageAlias] : null;

            if (context.InputParameters.Contains(“Target”) && context.InputParameters[“Target”] is Entity)

            {

                Entity entity = (Entity)context.PostEntityImages[“PostImage”];

                if (entity != null && entity.LogicalName.ToLower() != “new_employee”)

                    return;

                try

                {

                    if (!entity.Attributes.Contains(“new_company”))

                    {

                        throw new InvalidPluginExecutionException(“Cannot set the ‘Adviser File Number’ to be blank.”);

                    }

                    EntityReference companyId = (EntityReference)entity.Attributes[“new_company”];

                    if(companyId!=null){

                        Guid new_employeeid = companyId.Id;

                        tracingService.Trace(“new_employeeid : ” + new_employeeid);

                        Entity company = service.Retrieve(companyId.LogicalName, new_employeeid, new ColumnSet(“new_totalsalary”));

                        tracingService.Trace(“company : ” + company);

                        Decimal companyOldSal = (decimal)company[“new_totalsalary”];

                        tracingService.Trace(“companyOldSal : ” + companyOldSal);

                        Decimal empSal =  (decimal)entity[“new_salary”];

                        tracingService.Trace(“empSal : ” + empSal);

                        company.Attributes[“new_totalsalary”] = companyOldSal + empSal;

                        //company.Attributes.Add(“new_totalsalary”, companyOldSal+empSal);

                        service.Update(company);//This will update CurAccount entity.

                    }

                    else

                        throw new InvalidPluginExecutionException(“CompanyId is Null”);

                }              

                catch (FaultException<OrganizationServiceFault> ex)

                {

                    throw new InvalidPluginExecutionException(“An error occured in plug-in with Time Stamp:” + ex.Detail.Timestamp + “,Error Coode:” + ex.Detail.ErrorCode + “and Error Message:” + ex.Detail.Message);

                }

            }

            else

                throw new ArgumentNullException(“Trace3” + postImageEntity.Attributes.Contains(“new_company”).ToString());

        }

    }

}

Writing Plugin Using Plugin Registration tool

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using Microsoft.Xrm.Sdk;

using System.ServiceModel;

namespace ClassLibrary1

{

    public class Class1:IPlugin

    {

        public void Execute(IServiceProvider serviceProvider)

        {

            // Obtain the execution context from the service provider.

            IPluginExecutionContext context = (IPluginExecutionContext)

            serviceProvider.GetService(typeof(IPluginExecutionContext));

            // The InputParameters collection contains all the data passed in the message request.

            if (context.InputParameters.Contains(“Target”) &&

            context.InputParameters[“Target”] is Entity)

            {

                // Obtain the target entity from the input parmameters.

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

                if (entity.LogicalName == “new_company”)

                {

                    entity.Attributes[“new_totalsalary”] =  (Decimal)100;

                }

            }

            else

                throw new InvalidPluginExecutionException(“Company not found”);

        }

    }

}

Activate Deactivate Child Record based on Parent Record State Change

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using Microsoft.Xrm.Sdk;

using Microsoft.Crm.Sdk;

using Microsoft.Xrm.Sdk.Query;

using Microsoft.Crm.Sdk.Messages;

namespace ClassLibrary1

{

    public class OnCompaneyDeactivate : IPlugin

    {

        public void Execute(IServiceProvider serviceProvider)

        {

            IPluginExecutionContext context = (IPluginExecutionContext)

              serviceProvider.GetService(typeof(IPluginExecutionContext));

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

            IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

            if (context.InputParameters.Contains(“EntityMoniker”) && context.InputParameters[“EntityMoniker”] is EntityReference)

            {

                //Parent Entity (Account)

                EntityReference Companey = (EntityReference)context.InputParameters[“EntityMoniker”];

                //Capturing record  State & Status

                OptionSetValue state = (OptionSetValue)context.InputParameters[“State”];

                OptionSetValue status = (OptionSetValue)context.InputParameters[“Status”];

                #region De-Activate Related Contact Associated with Account Record

                //Note for  Active record  state value = 1 .

                // For In – Active record  State value = 0 .

                /// Check weather state value == 1.

                if (state.Value == 1)

                {

                    /// querry expression to retrieve related Contact associated to Account.

                    QueryExpression employee = new QueryExpression { EntityName = “new_employee”, ColumnSet = new ColumnSet(“new_employeeid”, “new_company”) };

                    //EntityReference c1 = (EntityReference)contact[“new_company”];

                    employee.Criteria.AddCondition(“new_company”, ConditionOperator.Equal, Companey.Id);

                    // Check weather statecode of the record are Active

                    employee.Criteria.AddCondition(“statecode”, ConditionOperator.Equal, 0);

                    EntityCollection Retrievecontact = service.RetrieveMultiple(employee);

                    if (Retrievecontact.Entities.Count > 0)

                    {

                        foreach (var a in Retrievecontact.Entities)

                        {

                            SetStateRequest contactsetStateReq = new SetStateRequest();

                            contactsetStateReq.EntityMoniker = new EntityReference(a.LogicalName, new Guid(a.Id.ToString()));

                            contactsetStateReq.State = new OptionSetValue(1);

                            contactsetStateReq.Status = new OptionSetValue(-1);

                            service.Execute(contactsetStateReq);

                        }

                    }

                }

                #endregion

                ///<Re Activate Relate record when Parent record status gets Activated>

                #region Re-Activate In-Active Contact Records

                /// Check weather state value == 0. For In active records

                if (state.Value == 0)

                {

                    /// querry expression to retrieve related Contact associated to Account.

                    QueryExpression employee = new QueryExpression { EntityName = “new_employee”, ColumnSet = new ColumnSet(“new_employeeid”, “new_company”) };

                    employee.Criteria.AddCondition(“new_company”, ConditionOperator.Equal, Companey.Id);

                    // Check weather statecode of the record are In-Active

                    employee.Criteria.AddCondition(“statecode”, ConditionOperator.Equal, 1);

                    EntityCollection Retrievecontact = service.RetrieveMultiple(employee);

                    if (Retrievecontact.Entities.Count > 0)

                    {

                        foreach (var a in Retrievecontact.Entities)

                        {

                            SetStateRequest contactsetStateReq = new SetStateRequest();

                            contactsetStateReq.EntityMoniker = new EntityReference(a.LogicalName, new Guid(a.Id.ToString()));

                            contactsetStateReq.State = new OptionSetValue(0);

                            contactsetStateReq.Status = new OptionSetValue(-1);

                            service.Execute(contactsetStateReq);

                        }

                    }

                }

                #endregion

            }

        }

    }

}

Duplicate Detection

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using Microsoft.Xrm.Sdk;

using Microsoft.Crm.Sdk;

using Microsoft.Xrm.Sdk.Query;

namespace ClassLibrary1

{

   public  class EmployeeDuplicateDetect : IPlugin

    {

        public void Execute(IServiceProvider serviceProvider)

        {

            IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));

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

            IOrganizationService service = (IOrganizationService)serviceFactory.CreateOrganizationService(context.UserId);

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

            if (context.InputParameters.Contains(“Target”) && context.InputParameters[“Target”] is Entity)

            {

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

                var Name = entity.GetAttributeValue<string>(“new_name”);

                #region  Retrieve All Employee Record

                QueryExpression EmployeeList = new QueryExpression { EntityName = entity.LogicalName, ColumnSet = new ColumnSet(“new_name”) };

                EmployeeList.Criteria.AddCondition(“new_name”, ConditionOperator.Equal, Name);

                EmployeeList.Criteria.AddCondition(“statecode”, ConditionOperator.Equal, 0);

                EntityCollection RetrievedEmployeeList = service.RetrieveMultiple(EmployeeList);

                //If the retrieved Account Count Greater Than 1, following Error Message Throw

                if (RetrievedEmployeeList.Entities.Count > 0)

                {

                    throw new InvalidPluginExecutionException(“Following Record with Same Name Exists”);

                }

                else if (RetrievedEmployeeList.Entities.Count == 0)

                {

                    return;

                }

                #endregion

            }

            else

                throw new InvalidPluginExecutionException(“Company not found”);

        }

    }

}

Shared Variables

Microsoft Dynamics CRM platform and the execution pipeline provides the ability to pass data from one plug-in to another through an IPluginExecutionContext property called SharedVariables. This property is a collection of key/value pairs which developers can use to share data between plug-ins which are registered on both the pre and post events.

ny value stored in the Plug-in context of Pre-event will be available in the Post-event of the Plug-in. This way, we can avoid storing the values in a custom attribute. 

PreEventPlugin

context.SharedVariables.Add("isDuplicate", true);
PostEventPlugin 
(Boolean)context.SharedVariables["isDuplicate"];

Limitation

For a plug-in registered in stage 20 or 40 of plugin execution pipeline, to access the shared variables from a stage 10 registered plug-in that executes on create, update, delete or by a RetrieveExchangeRateRequest, you must access the ParentContext.SharedVariables collection. For all other cases, IPluginExecutionContext.SharedVariables contains the collection.

What this means is that if the Shared Variable is being set during Pre-Validation, you need to look at the Parent Context to find it when retrieving it in a Pre-Operation or Post-Operation step. It may not be in the immediate Parent Context either; you may need to check each parent’s parent to find where the Shared Variable has been stored.

Lastly, you cannot share variables between steps using different messages and/or entities, even if one triggers the other.

You’d see that the IExecutionContext.Depth for the Contact plugin is set to 2, but the Shared Variables you set in the Account plugin will not be available to the Contact plugin.

User Impersonation

As the name suggests, impersonation in crm means acting on behalf of other user.

  • Because the run in user’s context property of a step make the whole plugin code of that step run on this user’s context.What if we just want to impersonate a user to access some record which isn’t otherwise accessible to the calling user? Yes, in that case we need explicit user impersonation in plugin code.
  • Impersonation gives the CRM developer more flexibility to target a particular action in a plugin they would like to run with elevation permissions.  The rest of the plugin actions can be run as

There are 2 pre-requisites of user Impersonation:

  • The user (impersonator) must have the ActOnBehalfOf privilege or be a member of the PrivUserGroup group in Active Directory.
  • Setting the CallerId property of the organization Web service proxy.

Actions (TBA)

Actions are messages that can defined for an entity. Existing examples messages include Create, Update, Set State, Assign etc. With Actions, the CRM platform has enabled the creation of custom actions for entities to extend the XRM platform.

An example of a custom action could be “Approve”. Often times we have to design an approval process for Dynamics CRM. Once the item is approved, certain actions need to be performed. In previous versions it would either be implemented as a Workflow that is manually executed from the Workflows Dialog or it involved added of a custom attribute that when checked would imply the item is approved and then the workflow would capture the update of this field to process any automated actions defined.

How to setup an Action?

Let us take an example of an approval process. When an item is “Approved”, we want to send email notifying the concerned parties of the approval. 

These actions are available for further implementation of custom business logic through the use of plugins. In some scenarios, say we need to validate certain conditions are met before the item can be approved. In this case we can register a plugin in the Pre-Stage of the Approve Message. The plugin could validate the conditions and throw an exception to abort the processing of the Approve Message.

Microsoft Dynamics 365 Workflows

Scope of Workflow:

Microsoft Dynamics 365 workflow has 4 Scope available as mentioned below:

  • User – Workflow will only run for those records whose owner is workflow owner itself or Logged in User only.
  • The Workflow will only affect records owned by the owner of the Workflow. Therefore, it’s almost set up like an individual Workflow.
  • When you select this Scope, it means it will only run on the records owned by the same user as the Workflow user.
  • Business Unit:  Workflow will only run for those record whose owner is in the same BU of workflow owner.
  • The Workflow will only affect records for all owners that are in the same business as the Workflow owner.
  • Parent-Child Business Unit: Workflow will for those record whose owner is in the same BU and Child BU of workflow owner BU.
  • Organisation:  Workflow will run for all records in organization regardless of owner

Execution Context of Workflow:

  • It depends. Automatically triggered workflows (such as a workflow that triggers on contact create) will execute in the context of the owner of the workflow. Therefore, if you have a send email step, the email will be by default sent from the e-mail contact of the workflow owner. This is important to consider because the workflow owner might belong to a different business unit and have different privileges than the user who triggered the workflow (e.g. who created the contact).
  • Let’s say your workflow creates a task each time an account is created. Depending on the privileges of the user, the task might be in another business unit and not visible to the user, therefore you should consider adding an “assign step” that assigns the new task to the owner of the account.
  • Now, if the workflow is executed on-demand, the workflow will then execute in the context of the user who requests the workflow execution. Because dialogs are always on-demand then they always execute in the context of the user who started the dialog.

Custom Workflow

Create Project of type CRM Workflow

Open the Visual Studio;

go to File → New Project → Dynamics CRM → Dynamics CRM 2011 Package and Click Ok.

After that Connect to Dynamics CRM Server

On click of Ok button the package will open then add a new project to this package. Right click on solution → Add → New Project.

The below window will be pop up to select the project type. Select Dynamics CRM 2011 Workflow Library, give the project name and click Ok.

double click on “RegisterFile.crmregister”

This will open the below file, here change the IsolationMode to “Sandbox”.

Build the solution and deploy. After that go to CRM and create a Workflow as per your requirement and add the Custom workflow assembly to this workflow as shown in below screen shot.

Add class EmployeeAssignment to the project.

Refrence required:

Microsoft.xrm.sdk

Microsoft.xrm.sdk.workflow

Microsoft.crm.sdk.proxy

System.Runtime.Serialization

Modify your class definition like below to inherit

Extend the EmployeeAssignment  with CodeActivity

BUSINESS PROCESS FLOWS

 process can span across a maximum of 5 unique entities. Those entities do not have to be related. An entity used in the process can be revisited multiple times. You can use a maximum of 30 stages per process and maximum of 30 steps per stage. 

A branch can be no more than 5 levels deep and must be based on the steps in the stage that immediately precedes it. You can combine multiple conditions in a rule by using the AND or the OR operator, but not both operators. Only one active process per record is possible, but processes can be changed at anytime.

Consider 2 Business Process Flows:

A) Purchase Immediate

B) Next Quarter

Create a workflow ‘Change Status’ 

This workflow will trigger when the Lead is created and when the Purchase TimeFrame field is changed.

A Condition for checking the Purchase Timeframe field on Lead record is subsequently added.

If Purchase Timeframe == Immediate then the Purchase Immediate Process flow would be set.

Here are the steps:

Click ‘Perform Action’ from Add Step. Select SetProcess and Entity as None (Global). Then click ‘Set Properties’. A ‘Set SETPROCESS input window’

Here the desired process which needs to be set is selected. In this case, set ‘Purchase Immediate’.

In Target select the Entity for which the Business Process flow needs to be set. In our case select the Lead itself.

In similar way, check if Purchase TimeFrame == ‘Next Quarter’ then set ‘Next Quarter’ process.

Save the workflow and activate it.

Now, test the above workflow.

Then quickly create a Lead Record ‘Test Lead Record for Immediate’ with Purchase TimeFrame == ‘Immediate

In order to set the Business Process flow, two required parameters need to be passed to the request.

  •  It is a type of Entity Reference. We need to pass the process guid.
  •  This Parameter is also a type of Entity Reference. We need to pass the guid and logical name of entity for which we are setting the Business Process Flow.

//call Create Lead function

           Guid RecordId = CreateLead(errorHandler);

           //create an object of setprocess request

           SetProcessRequest setProcess = new SetProcessRequest()

           {

                //set process entity refrence

                NewProcess=new EntityReference(“workflow”,new Guid(“D1090355-279E-432C-872F-14414E3AFCC0”)),

               //set target entity refrence

               Target = new EntityReference(“lead”, RecordId)

           };

           //Execute Set Process request

          _service.Execute(setProcess);

exciting to know that you no longer need to write codes for changing the process flow

Rollup Field

Dynamics 365 creates two asynchronous recurring system jobs as below when new Rollup field in created for an entity:

Mass Calculate Rollup Field – This job is created per Rollup field and runs when you create or update Rollup field. By default, job runs in 12 hours after you create or update Rollup field. You can adjust start time of this job to make sure job runs during non-operational hours

Calculate Rollup Field – One job per entity and gets created when first Rollup field is created for an entity and deleted when last Rollup field is deleted. This job is responsible for incremental calculation for all Rollup fields in an entity after Mass Calculate Rollup Field job finishes execution. By default, this job is schedule to run every hour which is maximum recurrence setting

view as:

  • Go to Settings -> System Jobs. Select Recurring System Jobs view from dropdown
  • Apply filter on System Job Name contains “entity name”

 case you want to calculate Rollup field immediately whenever child record gets created, updated or deleted, you can write custom C# plugin or custom workflow activity and use SDK message “CalculateRollupFieldRequest”. For more information refer blog.

Permissions:

  • You should have write access on parent entity where rollup field is created. You do not need to have write access on child entity. For ex: In case of Open Opportunities for an Account rollup field, you need write permissions on account entity only.

Limitations:

  • You can have 100 rollup fields per organization and 10 per entity at max
  • You can trigger workflow on change of rollup field value
  • Rollup field cannot refer another rollup field or calculated field
  • Rollup fields are not supported in offline mode while working with mobile/tablet
  • The maximum number of records during the rollup refresh is limited to 50,000 records. If the limit is exceeded, you see an error message: “Calculations can’t be performed online because the calculation limit of 50,000 related records has been reached.”. This limit does not apply when the rollup is automatically recalculated by the system jobs
  • The maximum hierarchy depth is limited to 10 for the source record. If the limit is exceeded, you see an error message: “Calculations can’t be performed online because the hierarchy depth limit of 10 for the source record has been reached.”. This limit does not apply when the Rollup is automatically recalculated by the system jobs

Working as a senior developer in microsoft technologies.

Well versed with every phase of SDLC cycle.

Microsoft Dynamics Consultant with 7 years of experience in Microsoft .NET technologies. Proficient and well versed with Dynamics 365 configurations, customization and extensions as my primary skills. Well experienced in .net tools and technologies including ASP.NET, ADO.NET, WCF, C#, SQL Server. Have extensive experience with data migration projects using SSIS, data reporting using SSRS and Power BI.

Currency Fields

Access Team

The typical initial approach for defining access to records for a user or team-owned entity is by user ownership. When assigning records to users, they are granted permissions only to records they own. 

This provides for a very simple model, yet very restrictive in that only one user is granted permissions through ownership. Due to the CRM user to Business Unit relationship, this record also gets linked to the respective Business Unit.

When assigning records to a team versus a user, you can grant multiple users access to the record via ownership.

Sharing VS Access Team Model

Some important design considerations should be considered when trying to determine which approach to use. Retrieval times to records using the ownership model grow independent of the amount of data in the system. With the sharing model retrieval times grow in direct proportion to the amount of data shared with the user. Although the pure number of teams in the system does not cause any impact, the number of owner teams a user is a member of can slow down retrieval times.

Whenever talking about the scalability of sharing in CRM, it helps to have an understanding of how it is accomplished. Two tables are involved whenever sharing a record, the SystemUserPrincipal and PrincipalObjectAccess tables.

The SystemUserPrincipal table contains the security principal information, the User’s Role, Team, Business Unit and Organization and their relationship to other security principals.

PrincipalObjectAccess

(PoA) table stores the sharing rules between the security principals and individual records for each entity. This includes the specific permission’s to read, write, assign, share, etc. as well as all inherited permissions from cascading shares.

In order to determine access, the SystemUser table is compared to the SystemUserPrincipal table to understand which records the user has permissions. In the second step, the record set is compared to the POA table to understand what permissions are granted for the records.

Services

Organization Service

Organization service is available since Microsoft Dynamics CRM 2011 and is mainly used for server side development i.e. code running on Microsoft Dynamics CRM server.

  • Implements IOrganizationService interface.
  • Organization service is also known as SOAP endpoint.
  • Microsoft Dynamics CRM uses Windows Communication Foundation (WCF) to SOAP endpoint.
  • It is the primary web service for accessing data and metadata from Microsoft Dynamics CRM organization.
  • It is built on WCF and optimized for use with the .Net.
  • Organization service request and response has SOAP format.
  • Microsoft Dynamics CRM SDK provides assemblies and tools to generate strongly typed classes and proxies to simplify development in Microsoft Visual Studio.
  • Maximum 5000 records can be returned in a single query.

Organization Data Service

Organization Data service is available since Microsoft Dynamics CRM 2011 and is mainly used for client side development (code running in browser) using JavaScript.

It supports JSON format for request and response which can be easily handled from JavaScript, therefore this is preferred service for client side development.

  • It is preferred service for client-side development.
  • Organization Data service is also known as “OData” or “REST” endpoint.
  • Microsoft Dynamics CRM uses Windows Communication Foundation (WCF) to provide REST-based service.
  • It supports JSON and ATOM format.
  • Organization Data service can be used within Web resources, form scripts and ribbon commands.
  • Authentication is provided by the application itself, no need to write authentication code.
  • It implements OData v2 standard.
  • It is deprecated with Microsoft Dynamics CRM 2016, Web API should be used to support Microsoft Dynamics CRM 2016 and future versions.
  • It can return maximum 50 records in a single retrieve operation.

It is much faster as compared to Organization service, because less bytes in JSON message in comparison to SOAP message

Web API

Web API is introduced with Microsoft Dynamics CRM 2016 and will provide parity with the Organization service.

Web API provides parity with Organization service with some limitations.

 It implements OData (Open Data Protocol) version 4.0 which is an open standard for building and consuming RESTful APIs over rich data sources like DOC, HTML and PDF.

Because Web API is built on open standards therefore it’s no necessary to use Microsoft Dynamics CRM provided libraries, third-party libraries can be used to generate classes.

List of available libraries

You can compose own Http requests as well.

Wep API supports wide variety of programming languages (including .Net, C++, Java, JavaScript, Python), platforms and devices as compared to Organization service.

Web API will gradually replace Organization service and Organization Data service to become single web service for Microsoft Dynamics CRM.

Wep API Request and Response have JSON format, so it is very easy to work with Wep API from JavaScript.

Authentication is provided by the application itself when used within web resources, form scripts and ribbon commands.

Maximum 5000 records can be return for each request.

Entity

Entity Ownership

  • In Dynamics 365, most of the entities (including custom entities) are owned by the organization, by a user, or a team.
  • The type of ownership determines some of the operations that can be performed on a record.
  • Ownership for an entity is defined in the metadata property OwnershipType.
  • For Organization type entity records, we can’t see Assign button or Share button.

Server Config

CRM 2011 has lots of links to its server name, in the active directory groups it creates (4 or 5 of them) and probably in some configuration files and the MSCRM_CONFIG database.

If we change Server Name Following things get broke

  • CRM Deployment manager
  • CRM application
  • SQL Server (Configuration)
  • MSCRM_CONFIG database
  • SSRS
  • Registry Settings!

Concerning Active directory

  • PrivUserGroup
  • SQLAccessGroup
  • ReportingGroup
  • PrivReportingGroup

MS CRM Database

Database Type Database Name Description
Config Database MSCRM_Config This database will contain CRM Server information deployment, such as users and licensing. One config database will be created during the time you  install CRM server. It is important to remem that  each deployment requires its own database instance
Content Database Organization_name_MSCRM This contains the discussed CRM metadata architecture. All configurations are in the metadata.
Reporting Services databases ReportServer and ReportServerTempDB ReportServer and ReportServerTempDB will be the default report databases. Microsoft Dynamics uses SQL Server Reporting Services which must be installed in native mode.

Plug-ins 2 minute timeout SQL 30 second timeout for database transactions Running workflow jobs Fair use – no specific hard limits, but the resource is balanced across organizations Direct database access Not allowed

MSCRM_CONFIG 

Gets installed when we install Dynamics CRM on premise

The MSCRM_Config database is the database which stores all of the configuration information for your CRM installation. 

You only need to restore the config database if you are doing a full server recovery – if you are moving an org you only need to import the MSCRM database. The config database contains deployment settings and user mappings.

When restoring to different environment you dint need to restore thus database..you just need to restore your organization database and need to use deployment manager to import organization into crm.

MS CRM Architecture

Metadata Driven Architecture

Microsoft Dynamics CRM uses metadata driven architecture to provide the flexibility to create custom entities and additional system entity attributes. This structure also makes upgrades and the transportation of customization easier.

At its core, MDDA is a deviation from hard-coded logic, to one of dynamic rendering and execution of user interfaces, business rules and workflows.

Metadata driven architecture (MDDA) is used to abstract function from logic.  Metadata creates a logical self-describing framework for allowing the data to drive application features and functionality. Metadata is commonly found inside of database schemas, XML configuration files, SOAP WSDLS, HTML web pages, rules engines and source code.

Multitier architecture (often referred to as ntier architecture) or multilayered architecture is a client–server architecture in which presentation, application processing, and data management functions are physically separated.

Microsoft Dynamics CRM is a web-based application that uses a multi-tier architecture enabling the platform to be extended and scaled. Microsoft Dynamics CRM is built on the following components;

  • Microsoft SQL Server database
  • Web services
  • System services (workflow, metadata, and integration)
  • A query processor that supports the entity model
  • Secured ad hoc queries that use an XML fetch statement to protect the physical database
  • Plug-ins for business logic extensibility
  • Reporting services
Description: ic60761

Activity Pointer

Common Data Model

MS CRM Topics to Learn

  1. Plugins
  2. Javascript
  3. CRM 2013 new features
  4. CRM 2015 new features
  5. WCF webservices
  6. Dialogs
  7. Certifications
  8. programming
  9. reports (Bids and SSRS)
  10. Data import (Scribe, SSRS)

Authentication Mechanism in MS CRM

Windows authentication
Windows authentication is available to clients who want to authenticate using Kerberos or NT LAN Manager (NTLM). It is used in an intranet setting where all users are members of your Active Directory (AD) domain. When a client tries to log into the CRM website anonymously, they receive a 401 error. They get redirected to AD where their Windows (logon) credentials are compared to an existing account. AD then grants them a Kerberos ticket which they use to authenticate into the site. CRM accepts the ticket and pushes content to the client.

claims-based authentication for internal access

This authentication method is used in a multiple domain environment where there is no trust between domains, or where users exist in a different attribute store; users are authenticated internally.

When an anonymous request is sent to the CRM server, it is rejected with a 302 error and the client is redirected to the Active Directory Federation Services (AD FS) login page.

By logging in, they send a request for a security token

In the event that they do not have a Kerberos ticket, the client sends their logon credentials to Active Directory and supplies that Kerberos ticket to AD FS.

claims-based authentication for external access

Accessing the CRM website through the internet using Internet-facing deployment (IFD) is now done with claims-based authentication

Both of the claims-based authentication methods are largely the same. The main difference between internal vs. external access is that Kerberos tickets are not used in external authentication.

When a user navigates to the CRM website, they are redirected to AD FS and prompted to login. If there exists more than one trusted claims provider in AD FS (Active Directory is the only claims provider by default), the user will select a claims provider. Users then login and the credentials are validated by AD FS.

A multiple server environment is recommended for a CRM server deployment. Although small businesses with a limited number of users can house AD FS and CRM on the same server, it is recommended to have AD FS and CRM on separate servers.

on premise

  • most commonly user records are linked to active directory
  • You can also used Internet facing deployment (IFD) where the authentication is either
  • AD FS (active Directory Federation Services)
  • STS (Secure Token service)

Online

  • Microsoft Online Subscription Program (MSOP)

Either type of authentication the security authentication is done and then if successful the user are signed into CRM and then CRM applies the correct security roles, privileges.

Team

 A team belongs to one business unit, but it can include users from other business units. A user can be associated with more than one team.

An access team doesn’t own records and doesn’t have security roles assigned to the team. 

The team members have privileges defined by their individual security roles and by roles from the teams in which they are members. The records are shared with an access team and the team is granted access rights on the records, such as Read, Write or Append.

Editing Sitemap in Dynamics 365

Editing default sitemap is similar to what we used to do with XrmToolbox. However, with the unavailability of XrmToolbox to achieve this, we need to use the Dynamics 365 Sitemap Editor to do this.

For editing navigate to solution you want to sitemap

Under client extentsion select SiteMap

It will then open up the Dynamics 365 Sitemap Editor. Conceptually it’s the same as the way we configure Sitemap using the XrmToolbox, but with different user experience and layout.

Managing Users

There are a number of functionality to manage users and you can find these by going to Settings – Administration

  • Creating users, teams, Security Roles
  • assign/move users to teams, assign security roles to teams and users
  • Disable business units
  • Delete Security roles, Delete teams
  • Move users between teams
  • Manager

each user can have one manager assigned to them.  The manager look-up can be found on the user record, I  think it’s used in routing.

URLS

Create or edit an app

Open the app designer from the My Apps page or from the Apps area in the Solutions window.

Create an app

Make sure that you have the System Administrator or System Customizer security role or equivalent permissions.

  • Specifically, any user with the following privileges can also create apps:
  • Create, Read, and Write privileges for the App entity
  • Read and Write privileges for the Customizations entity
  • Read privileges for the Solution entity

Go to Settings > Customizations. Click Apps, and then on the Action toolbar, click New.

New Button CRM 2011

In one of my requirement i need to update the selected records in the home page contact entity grid by clicking on the custom ribbon button.

Open Visual Ribbon Button editor 2011/2013

function UpdateSalary(selectedEntityRefs)

{

alert(“Id: ” + selectedEntityRefs[0].Id +

“\n Name: ” + selectedEntityRefs[0].Name +

“\n TypeCode: ” + selectedEntityRefs[0].TypeCode +

“\n TypeName: ” + selectedEntityRefs[0].TypeName);

}

function UpdateSalary(selectedIds) {

debugger;

    if (selectedIds != null && selectedIds != “”) {

        var strIds = selectedIds.toString();

        var arrIds = strIds.split(“,”);

        for (var indxIds = 0; indxIds < arrIds.length; indxIds++) {

            updateContactRecords(arrIds[indxIds]);

        }

        alert(“Selected Records Updated Successfully”);

    }

    else {

        alert(“No records selected!”);

    }

}

function updateContactRecords(contactId) {

    var objContact = new Object();

    objContact.new_salary = 141.22;

objContact.new_name=”test”;

objContact.new_id=111111;

    var jsonEntity = window.JSON.stringify(objContact);

    var serverUrl = Xrm.Page.context.getServerUrl();

    var ODATA_ENDPOINT = “/XRMServices/2011/OrganizationData.svc/new_employeeSet”;

    var ODataPath = serverUrl + ODATA_ENDPOINT;

    $.ajax({

        type: “POST”,

        contentType: “application/json; charset=utf-8”,

        datatype: “json”,

        url: ODataPath + “(guid'” + contactId + “‘)”,

        data: jsonEntity,

        beforeSend: function (XMLHttpRequest) {

            XMLHttpRequest.setRequestHeader(“Accept”, “application/json”);

            XMLHttpRequest.setRequestHeader(“X-HTTP-Method”, “MERGE”);

        },

        error: function (xmlHttpRequest, textStatus, errorThrown) {

            alert(“Status: ” + textStatus + “; ErrorThrown: ” + errorThrown);

        }

    });

}

MS CRM 365: Adding javascript

Ref: https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/walkthrough-write-your-first-client-script

var Sdk = window.Sdk || {};

(function () {

// Define some global variables

var myUniqueId = “_myUniqueId”; // Define an ID for the notification

var currentUserName = Xrm.Utility.getGlobalContext().userSettings.userName; // get current user name

var message = currentUserName + “: Your JavaScript code in action!”;

// Code to run in the form OnLoad event

this.formOnLoad = function (executionContext) {

    var formContext = executionContext.getFormContext();

    // display the form level notification as an INFO

    formContext.ui.setFormNotification(message, “INFO”, myUniqueId);

    // Wait for 5 seconds before clearing the notification

    window.setTimeout(function () { formContext.ui.clearFormNotification(myUniqueId); }, 5000);       

}

this.formOnSave = function () {

        // Display an alert dialog

        Xrm.Navigation.openAlertDialog({ text: “Record saved.” });

    }

}).call(Sdk);

IFrame in CRM 2011

Ref: https://nishantrana.me/2010/12/19/working-with-crm-forms-in-iframe-in-crm-2011/

IFrame also allows the user to access the website within Dynamics 365 without ever leaving the web client.

The first thing we need to do is set up the sitemap components in Dynamics 365.

We can then construct a simple IFrame within our HTML Web Resource. The best practices for this is to get the website URL into my HTML Web Resource from a configuration file or a custom Setting entity for configuration maintainability and portability of code. Since we’re possibly accessing CRM components, we would need to use the Global Context with JavaScript. But for purposes of this demonstration, I’ve hard-corded the example website URL into the IFrame tag below.

Creating Early Bound Classes

Navigate to SDK\Bin folder.

Make sure Xrm Folder pre exit, if not create it.

Open Command prompt change its directory to $SDK\Bin.

Run below command

CrmSvcUtil.exe /codeCustomization:”Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration” /out:Xrm\Xrm.cs /url:http://<servername>/<OrgName>/XRMServices/2011/Organization.svc /domain:***** /username:***** /password:**** /namespace:Xrm /serviceContextName:XrmServiceContext

CrmSvcUtil.exe /codeCustomization:”Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration” /out:Xrm\Xrm.cs /url:http://sqldavirtual082.appdevglobal.lloydstsb.com:5555/TestNewOrg/XRMServices/2011/Organization.svc /domain:appdevglobal /username:mgr8788218 /password:June!2019 /namespace:Xrm /serviceContextName:XrmServiceContext

CRM2011: Console Application

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Data.Services;

using Microsoft.Xrm.Sdk.Client;       // OrganizationServiceProxy

using System.ServiceModel.Description;   /// used for ClientCredentials

using Microsoft.Xrm.Sdk;   //Entity

namespace ConsoleApplicationCRM2011

{

    class Program

    {

        static void Main(string[] args)

        {

                ClientCredentials creds = new ClientCredentials();

                // Credentials

                creds.Windows.ClientCredential = new System.Net.NetworkCredential(“mgr8788218”, “June!2019”, “appdevglobal”);

                OrganizationServiceProxy service = new OrganizationServiceProxy(new Uri(“http://10.40.81.154:5555/TestNewOrg/XRMServices/2011/Organization.svc&#8221;), null, creds, null);

                service.Timeout = new TimeSpan(0, 5, 0);

                //service.EnableProxyTypes();

            Entity ent = new Entity(“contact”);// creation of entity

               ent.Attributes[“firstname”] = “test2”;

              ent.Attributes[“lastname”] = “test3”;

               service.Create(ent);

            }    

        }

    }

SSIS Integration

SSIS Integration

The SQL Server Integration Services (shortly called as SSIS) is a powerful ETL tool. This SSIS ETL tool is used for building enterprise-level data transformation, and data integration solutions. Remember, SSIS is the second largest tool to perform Extraction, Transformation and Load (ETL) operations.

You can use SQL SSIS for updating data warehouses, data mining, downloading or copying files, extract and transfer data from XML to SQL etc.

SSIS is a platform for building data integration solutions and it is a service that runs on the SQL Server.

Before we get started, here’s the list of requirements:

In this blog, I will use a simple example to show you how to send contact data stored in a SQL database to MSCRM 2011 via CRM Web Services using SSIS.

The source data is from the data from the other system that you would like to send to the CRM system. You source data can be a text file, an Access database, an Oracle database, etc… In this example, I will create a simple Contacts table in a SQL database that’s already existed in environment.

Sql Integration Services 2008 support libraries with target versions of .Net Framework 2.0, 3.0 and 3.5 so it is impossible to use SDK assemblies (which have 4.0 version of .Net Framework). Because of this reason it would be required to use Service reference instead of usual referencing of SDK assemblies.

pen Visual Studio 2008 or 2010, choose new project, select .Net Framework 3.5 as target framework and type of project as Class Library.

Click with right of mouse on References and choose “Add Service Reference”:

Input reference to endpoint of your CRM application, fill namespace and click OK:

Sign this assembly because it will be put to GAC:

Build and install this assembly to GAC using drag-drop to C:WindowsAssembly folder ot gacutil:

SSIS Package

Start new SSIS Project:

Drag-drop Data Flow Task to Control Flow Pane

Create new Connection to SQL DB which will be used for datasource:

Open Data Flow tab of project and drag and drop Ole DB Source:

Open and configure it:

Drag and Drop Script component to Data Flow tab, choose Transformation type, connect output of Ole DB Source and Script component:

Open script component, choose columns that should be transferred inside it and click Edit Script button to edit script:

Add reference to assembly that was created step before and System.Runtime.Serialization:

Save, rebuild and close Visual Studio with script.

That’s it and everything is ready to run package.

Create CRM Proxy Class

Start a New C# Class Library Project

  • Create a project name “CRM.Proxy”

Sign the Project

Right click on the project and select “Properties”.

Click on “Signing” tab and check the “Sign the assembly” checkbox.

Select “<New>” from “Choose a strong name key file” dropdown.

Give it a name for the Key. In this example, I use “integration” as my key name.

Add CRM Web Services

Microsoft SQL Server Management Studio

Microsoft SQL Server 2008 R2

Interview Questions

executionContext :

Represents the execution context for an event in Customer Engagement forms and grids.

The execution context defines the event context in which your code executes. The execution context is passed when an event occurs on a form or grid, which you can use it in your event handler to perform various tasks such as determine formContext or gridContext, or manage the save event

The execution context is passed in one of the following ways:

Defining event handlers using UI: The execution context is an optional parameter that can be passed to a JavaScript library function through an event handler.

Defining event handlers using code: The execution context is automatically passed as the first parameter to functions set using code.

XRM Object

The Xrm object is globally available to use in your code without having to use the execution context in Client API.

Example:

Xrm.Device : Provides methods to use native device capabilities of mobile devices.

Xrm.Utility: Provides a container for useful methods.

Xrm.WebApi: Provides methods to use Web API to create and manage records and execute Web API actions and functions.

Use the Xrm.Utility.getGlobalContext method in forms to retrieve information specific to an organization, a user, or the client where script is run without going through the form execution context. This is a change from previous versions where you had to use the form context to retrieve global context by using Xrm.Page.context.

Note

Xrm.Page.context is deprecated in the current release, and you should now use the new Xrm.Utility.getGlobalContext method to get global context in your code targeting version 9.0 or later.

DLL Extrection

Important classes

OrganizationServiceProxy

PrincipalObjectAccess

The shares granted on objects in CRM are stored in the very important PrincipalObjectAccess system table – (also known as the POA table) – This table is not visible to CRM users, but for On-Premise deployments, the Administrator can use SQL to view the contents of the table.

 customers struggle with performance as this table crosses the 10, 15 or 20 Million Record threshold. (The threshold for performance challenges gets pushed out with better optimized SQL servers.) – One tip is to make sure your SQL server is right-sized and the indexes are defragmented and maintained.

SELECT TOP 100
[PrincipalObjectAccessId] ,[PrincipalId] ,[PrincipalTypeCode] ,[ObjectId] ,[ObjectTypeCode] ,[AccessRightsMask] ,[InheritedAccessRightsMask] FROM
[PrincipalObjectAccess] WITH (NOLOCK)

PrincipalObjectAccessId – The GUID of share record.
PrincipalId – The GUID of the User or Team receiving the Share.
PrincipalTypeCode – indicates whether it’s a User or Team.
ObjectId – The GUID of the specific object being shared.
ObjectTypeCode – The object type of the record being shared.
AccessRightsMask – This field stores the rights granted directly via the ‘Sharing’ dialog.
InheritedAccessRightsMask – The rights applied by the system through cascading or reassignment processes are stored in this field. (These are not visible in the ‘Sharing’ dialog.

Useful Links Dynamics 365

Services

https://andz88.wordpress.com/
XRM Javascript
var xrmPage = window.parent.Xrm.Page;
var clienthierarchylevel = xrmPage.getAttribute(“lbg_clienthierarchylevel”).getValue();

var clientHierarchyLevel = Xrm.Page.getAttribute(“lbg_clienthierarchylevel”).getValue();

var id =Xrm.Page.data.entity.getId();
var entityName = Xrm.Page.data.entity.getEntityName();


Custom Lookup
http://www.inogic.com/blog/2015/08/apply-custom-filter-on-lookup-field-in-dynamic-crm-using-script/


Wait field
http://www.inogic.com/blog/2016/06/effect-of-various-date-fields-on-waiting-workflow-in-dynamics-crm/


Solutions
https://crmbusiness.wordpress.com/2014/03/31/crm-2013-overview-of-solutions/


Console App
https://community.dynamics.com/crm/f/117/t/192841

CRM Portal
https://www.fmtconsultants.com/step-by-step-guide-to-portal-development-for-microsoft-dynamics-crm/

CRM Date Time
https://community.dynamics.com/crm/b/develop1/archive/2011/12/06/dynamics-crm-datetimes-the-last-word

CRM- task from workflow
https://community.dynamics.com/crm/b/crmtipstricksnewstomaster/archive/2016/05/24/using-dynamics-crm-workflows-to-create-tasks-automatically

CRM JavaScripts:-
https://www.linkedin.com/pulse/getting-started-javascript-microsoft-dynamics-crm-hans-carlson

CRM2013
http://www.mscrmconsultant.com/2012/08/get-and-set-lookup-value-using.html

CRM 2013 – MB2-703 – Business Units and Security Roles Study Information
https://crmbusiness.wordpress.com/2014/04/29/crm-2013-mb2-703-business-units-and-security-roles-study-information/

https://msdn.microsoft.com/en-us/library/gg334708.aspx
Sample: Retrieve multiple with the QueryByAttribute class

https://msdn.microsoft.com/en-us/library/gg328149.aspx
Sample: Retrieve multiple with the QueryExpression class

Importing and Updating Records in Microsoft Dynamics CRM
http://www.powerobjects.com/2013/08/01/updating-records-in-microsoft-dynamics-crm/

On demand workflow
https://community.dynamics.com/crm/b/mahenderpal/archive/2014/01/29/step-by-step-running-on-demand-workflow-for-all-active-records

You can have two organizations using same sql server Instance but not 2 CRM server installations. Each CRM server will create it’s own
MSCRM_CONFIG database , What you can do is install another instance of sql server database on the same server and use that instance of the sql
server to install new CRM server. One more thing to give attention is if you are planning to use same sever for reporting service then you can’t use
that SSRS server for another installation of crm Instance.

Plugin not triggered in data import***
As you mentioned that your plugin is not working in case of Import , I suspect because in your plugin you have checked for a condition of depth
property that is if Context.depth > 1 ; return from the code.
When you import data using import wizard the depth is always grater than 1 and if I am not forgetting it is 2.
I will suggest you to debug your plugin code while importing of data to get the exact value of depth in that case and accordingly change the
Context.depth condition.
Secondly if you are updating data using import ,apart from the above depth condition make sure one of the field with in the import file must be in
the filtering Attribute(if you are applying filtering Attribute) during plugin step registration or else do not include any filtering Attribute ,
let it be ALL.
Hope this will resolve your issue,thanks

Plugin tracing**
http://www.powerobjects.com/2015/04/01/dynamics-crm-2015-spring-update-1-plug-in-trace-log/

Plugin holiday ***
https://community.dynamics.com/crm/b/hayersdynamicscrm/archive/2014/06/20/dynamics-crm-how-to-add-working-days-by-calculating-business-closure-and-weekends

Plugin UnSecured Congfiguration*

https://community.dynamics.com/crm/b/zsoltzombiksblog/archive/2015/06/09/3-ways-to-add-configuration-parameters-to-plugins-in-dynamics-crm-2015-part-2

CRM 2015 Online – Accessing Subgrid data using Javascript

https://www.magnetismsolutions.com/blog/ahmed-anwar%27s-blog/2015/08/24/crm-2015-online—accessing-subgrid-data-using-javascript

How to Create Test Cases for Microsoft Dynamics CRM with XMind
https://www.magnetismsolutions.com/blog/meghakainth/2017/10/12/how-to-create-test-cases-for-microsoft-dynamics-crm-with-xmind

show-or-hide-the-add-new-button-on-form-sub-grid
https://ribbonworkbench.uservoice.com/knowledgebase/articles/489288-show-or-hide-the-add-new-button-on-form-sub-grid

SUBGRID Count
var ctrl = Xrm.Page.getControl(“Courses”);
for(prop in ctrl)
{
if(typeof ctrl[prop].get_recordCount === ‘function’)
{
alert(ctrl[prop].get_recordCount());
break;
}

}

crm 2013: javascript get attributes from other entity in Contact Form

https://community.dynamics.com/crm/f/117/t/142957

You need the guid, name and entity type to set the value of a lookup field

activith

https://crmbusiness.wordpress.com/2015/11/12/crm-2015-what-developers-need-to-know-about-the-activity-entity/

enable/disable button on ribbon
https://ribbonworkbench.uservoice.com/knowledgebase/articles/121427-enable-disable-a-ribbon-button-dynamically-based-o


Iframe
https://community.dynamics.com/crm/b/crmsamples/archive/2010/04/14/how-to-show-related-record-8217-s-form-in-parent-form

“+” button defaults to the “Add existing” option on subgrids.
https://crmtipoftheday.com/8/make-a-subgrid-button-launch-a-new-record-form/


https://dynamicscrmgirl.wordpress.com/2014/01/04/crm-2013-javascript-retrieve-record-using-odatarest-endpoint-without-jquery/

http://sqldav02d7:5555/OneView/XRMServices/2011/OrganizationData.svc/lbg_courseSet?$filter=lbg_AssociatedTrainng/Id eq guid'{A4ADDA08-C4C2-E711-8D00-005056AA721B}’
——workflow from plugin—–
https://www.magnetismsolutions.com/blog/roshanmehta/2012/8/8/programmatically_fire_a_workflow_in_dynamics_crm_2011


pre vs post image
Message Stage Pre-Image Post-Image
Create PRE No No
Create POST No Yes
Update PRE Yes No
Update POST Yes Yes
Delete PRE Yes No

Delete POST Yes No

https://community.dynamics.com/crm/b/magnetismsolutionscrmblog/archive/2012/11/26/workflow-wait-conditions-best-practices-dynamics-crm-2011


http://fkbase.info/node/74

workflow state code

https://www.magnetismsolutions.com/blog/11-08-11/general_security_role_for_dynamics_crm_2011.aspx
——Code Beautifier—-
http://csharpindepth.com/codeformattertool.aspx

http://jsbeautifier.org/

https://community.dynamics.com/crm/b/misscrm360exploration/archive/2015/04/13/get-current-user-setting-timezone-crm-c

public void LogMessage(String message, EventLogEntryType type)
{
// Try and write to the windows event log. This will fail if the plug-in is running in Isolated mode
try
{
EventLog EL = new EventLog();
if (!EventLog.SourceExists(“MSCRM Plug-in”))
{
EventLog.CreateEventSource(“MSCRM Plug-in”, “Application”);
}
EL.Source = “MSCRM Plug-in”;
EL.WriteEntry(message, type);
}
catch
{
// Do nothing if there is an error writing to the event log
}
}


What Is Meant By Managed Properties?


https://www.wisdomjobs.com/e-university/microsoft-dynamics-crm-interview-questions.html

https://carldesouza.com/creating-dynamics-crm-plugin-from-scratch

https://www.linkedin.com/pulse/plugin-definition-isolation-mode-sandboxnone-store-dll-rami-heleg

https://community.dynamics.com/crm/b/crmchap/archive/2017/06/11/what-is-unsecure-secure-configuration-on-a-dynamics-crm-365-for-enterprise-plugin

http://dcrm365.blogspot.com/
https://yeshwanthco5.wordpress.com/2017/06/17/bulk-edit-and-restriction-of-bulk-edit-in-microsoft-dynamics-crm/
https://msdynamicscrmblog.wordpress.com/2013/05/10/use-executemultiplerequest-for-bulk-createupdatedelete-using-c-in-dynamics-crm-2011-2/
https://nishantrana.me/2015/07/04/using-action-to-trigger-plugin-in-crm-20132015/
https://garethtuckercrm.com/2011/03/16/jscript-reference-for-microsoft-dynamics-crm-2011/
https://bingsoft.wordpress.com/
————————————-SSIS
https://cloudblogs.microsoft.com/dynamics365/no-audience/2008/05/07/integrating-crm-using-sql-integration-services-ssis/?source=crm
http://quantusdynamics.blogspot.com/

https://readyxrm.blog/2019/06/06/what-is-the-power-platform/?blogsub=confirming#subscribe-blog
https://carldesouza.com/powerapps-canvas-apps-model-driven-common-data-dynamics-explained/
https://www.resco.net/resco-mobile-crm-security-guide/

https://community.dynamics.com/crm/b/conorssnippetdiary/posts/the-new-localplugincontext-and-new-baseplugin-class

https://arunpotti.wordpress.com/2019/05/03/how-to-assign-system-administrator-privilege-for-a-user-in-crm-using-sql/
http://crmdm.blogspot.com/2013/09/custom-fetchxml-based-report-in-crm.html

https://itsolutions.bdo.ca/insights/tag/quick-tip/

MVP LIST
https://community.dynamics.com/badges/206?pifragment-92198=2
https://crmbusiness.wordpress.com/2014/12/10/12-ways-to-become-a-better-crm-developer/
Microsoft Dynamics CRM Blogs
https://community.dynamics.com/crm/b

debug plugin
https://nishantrana.me/2014/07/02/debugging-online-plugin-in-crm-2013/

https://antonyellisdynamicscrm.wordpress.com/2017/02/22/connecting-to-dynamics-365-and-earlier-crm-versions/
https://antonyellisdynamicscrm.wordpress.com/2017/03/16/understanding-dynamics-365-solutions/

https://community.dynamics.com/365/b/prasannavadlamudiswebblog/posts/authentication-in-dynamics-365-web-api-and-difference-between-microsoft-dynamics-365-web-api-organization-service-and-organization-data-service

Ahmedzaade
Kafeel@2019

Entity

https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/introduction-entities

Definition

The entities are used to model and manage business data in Dynamics 365 for Customer Engagement apps. For example, entities such as account, campaign, and incident (case) can be used to track and support sales, marketing, and service activities. An entity has a set of attributes and each attribute represents a data item of a particular type. For example, the account entity has NameAddress, and OwnerId attributes. Conceptually, an entity is like a database table, and the entity attributes correspond to the table columns. 

Creating an entity record (or, simply a record) in Dynamics 365 for Customer Engagement apps is like adding a row in a database table. The entities are divided into three categories: system, business, and custom. As a developer working with business data, you will use business and custom entities. System entities are used by Dynamics 365 for Customer Engagement apps to handle all internal processes, such as workflows and asynchronous jobs. You cannot delete or customize system entities. Creating an entity record (or, simply a record) in Dynamics 365 for Customer Engagement apps is like adding a row in a database table. The entities are divided into three categories: system, business, and custom.