Plug-in Customization’s:-
Plug-in: Plug-in
is a custom business logic used to extend the standard functionality of
Microsoft Dynamics CRM. For Example if we want to do operations after creation
or updating of record or before deletion of record we can use plug-inn’s to
extend the operations.
Plug-inn’s can be written and compiled in .net framework and
deploy in ms crm database using plug-in registration tool or by using code or
by deploying manually in case of on premise crm.
Plug-in Registration steps:-
1. Write
a plug-in code and compile code.
2. Open
registration tool and connect to organization.
3. Register
a new assembly.
When click on Register New Assembly will pop up a window is
In above screen can see multiple options like Specify
Isolation Mode , Specify the location where the assembly should stored.
Specify Isolation
Mode
1 Sandbox: Sandbox
mode is fully secure means it won’t allow third party dll’s.For online crm must
and should register plug-inn in sandbox mode only.
2 None: This mode
can allow third party dll’s also, basically we can use this option in On
Premise or IFD crm’s .If the plug-in using any third party dll then those dll’s
also need to deploy in server bin/assembly folder then only plug-in work
properly.
Specify the Location
where the Assembly is stored
Database: Dll
will store in database. Its default option and it’s a strongly recommended to
select database while register plug-in because it’s easy to move dll from one
environment to other.
Disk: if we
select Disk option dll will store in bin/assembly folder. if we use this option
we need to manually copy and paste the dll while moving solution one
environment to other. Because while moving solution actually dll is not stored
in database, just it stores the information where the plug-in is stored those information
only moved to another environment. While executing crm tries to load the plug-in
using the path but it couldn’t find because there is no plug-in in that location.
So need to copy and paste the dll manually.
GAC: This mode
also works same as disk but dll is stored in GAC folder in crm server.
4. Next need to select the registered assembly.
It can contain multiple plug-ins. Select the plug-in you are adding steps to,
and register one or more steps.
In above screen we have multiple options need to fill in
order to create a plug-in step:
Message: when we
type in this field it auto populate the message names. It represents on which
message to register event.
Primary Entity:
It allows selecting entity on which plug-in step will be registered.
Secondary Entity:
In 4.0 version this option is used while registering a plug-in on
associate/dissociate
messages. Now this option is deprecated but still we can use.
Filtering Attributes:
this option allows to user to select the fields, and it represents that plug-in
will fire only these fields are changed.
Run in User’s Context:
this option used to execute the plug-in on behalf of other user not on logged
in user.
Execution Order:
if we have two plug inn’s on same message we can set the execution order so
that crm will execute the plug inn’s in that order only.
Event Execution
Pipeline:
Pre Validation: Plug
inn’s get executed prior to the form validation.
It is use full when we need to capture the deleting records,
means some scenarios we cannot capture the deleting records data even in pre
operation also. For example if take parental cascade behaviour if we delete
parent record then all its child records also deleted. Now the requirement is
need to capture the child records while the parent record is deleting. In this scenarios
we can use pre validation plug inn’s.
Pre Validation plug inns execute outside transaction means
if something went wrong while executing plug-in it won’t roll back.
Pre Operation: plug
inn’s get executed before the data is saved to database. These are within
database transaction only.
Post Operation: plug
inn’s get execute after the data is saved to database.
Execution Mode
Synchronous: Plug
inn’s execute immediately and it will show impact on performance because
synchronous plug inn’s runs on same crm main process.untill plug inn execution
is completed it won’t allow the user to do other operation’s.
Asynchronous: Plug
inns are moved to queue and will execute later. it will not affect the
performance because these plug inn’s execute under different processes.
5 that’s all we have done the registration of plug inn then
go to crm and create or update the record to run a plug inn.