Here’s a comprehensive list of real-world scenarios where Plug-in development is required in Dynamics 365 CRM, along with the functionalities that are typically implemented:
✅ 1. Data Validation
Scenario: Ensure that required business logic is enforced before saving a record.
Functionality:
-
Prevent creating a duplicate Contact record based on email.
-
Validate if the Account has a valid credit score before enabling a field.
📍Trigger: Pre-Validation / Pre-Operation
✅ 2. Data Enrichment or Auto-Population
Scenario: Automatically fill in values based on business logic.
Functionality:
-
Auto-generate a Case Title using Customer Name + Case Type.
-
Set Opportunity Estimated Close Date as +30 days from Created Date.
📍Trigger: Pre-Operation
✅ 3. Custom Business Logic Enforcement
Scenario: Execute complex rules not possible using workflows or Power Automate.
Functionality:
-
Apply tiered discount rules on Opportunity Line Items based on account category.
-
If Opportunity value > $100K, notify Finance and Sales Director.
📍Trigger: Post-Operation / Async
✅ 4. Integration with External Systems (via Plugin)
Scenario: Push data from CRM to external system in real-time.
Functionality:
-
When an Order is created, send the data to ERP via Azure Service Bus.
-
Call a third-party REST API to validate a PAN number on Contact creation.
📍Trigger: Post-Operation (Async preferred for performance)
✅ 5. Entity Relationship Handling
Scenario: Update related entities or maintain integrity.
Functionality:
-
When a Lead is converted to Contact + Account, auto-link existing records if matching.
-
When a Case is resolved, update the related Account’s “Last Support Date”.
📍Trigger: Post-Operation
✅ 6. Record Ownership Logic
Scenario: Implement auto-assignment or escalation.
Functionality:
-
Auto-assign a Case to a user in a specific queue based on region or priority.
-
Escalate Opportunities not modified in 10 days to Manager queue.
📍Trigger: Post-Operation or Scheduled (via Custom Plugin or Flow)
✅ 7. Custom Calculations
Scenario: Perform complex calculations not handled by calculated fields.
Functionality:
-
Calculate rolling average revenue per customer based on Opportunities.
-
Distribute an invoice amount across multiple child accounts.
📍Trigger: Pre-Operation / Post-Operation
✅ 8. Auditing and Logging
Scenario: Track changes and custom audit trail.
Functionality:
-
Store old vs new values of a custom field into a separate log entity.
-
Log plugin failures with context details to a custom log table.
📍Trigger: Pre-Operation / Post-Operation
✅ 9. Conditional Field Locking or Security
Scenario: Enforce field-level rules beyond UI.
Functionality:
-
Prevent update of “Annual Revenue” after it’s set once.
-
Allow only Finance Role to modify Payment Terms field.
📍Trigger: Pre-Operation
✅ 10. Multi-Step Complex Workflows
Scenario: When Power Automate isn’t performant or extensible.
Functionality:
-
Multi-entity conditional logic (if Contact is VIP, and Account Tier = Gold, then do X).
-
Workflow branching logic that spans plugins and workflows.
⚙️ Plugin Execution Context and Events
| Stage | Description | Common Use |
|---|---|---|
| PreValidation | Before DB transaction starts | Input validation, external API call |
| PreOperation | After validation, before DB save | Modify input, default values |
| PostOperation | After DB transaction | Integration, related updates |