A Plug-in is a custom business logic code which is used to execute an action when a particular event takes place. It acts as event handlers in CRM and is triggered in events like create, update, delete, etc. Plug-ins are used to automate processes like sending emails to customers when some events take place in CRM.
Shared Variables in Plug-in:
Shared Variables in Plug-in was introduced in CRM 4.0. Shared variables are used for passing data between plug-ins registered on both pre and post events. So, instead of storing values in custom attributes, they can be stored in context variable. Read and write data into shared variables of context.
Real-time Shared Variables Business Scenario: