Dynamics 365 Plugins
This section contains documentation for all custom plugins and utility methods used in the Dynamics 365 implementation.
Assignment & Web Role Management
AssociateEntitiesPostOperationUpdate
Action: Associate | Stage: Post-Operation
Automatically assigns Contacts to appropriate Web Roles when they are associated with an Assignment. Uses JSON configuration to map Assignment names to Web Role permissions, ensuring users get the correct portal access automatically.
DisassociateEntitiesPostOperationUpdate
Action: Disassociate | Stage: Post-Operation
Intelligently removes Web Roles when a Contact is disassociated from an Assignment. Only removes Web Roles that are no longer needed—if another Assignment still requires a Web Role, it's preserved to prevent accidental loss of access.
Document Approval Management
DocumentApprovalDocumentSignersPostOperationCreate
Action: Create | Stage: Post-Operation
Creates Document Signer records when a new Document Approval is created. Identifies contacts with appropriate Data Approver roles based on the Service Line and automatically generates signer records for the approval workflow. Handles the "Specific Approvers" flag to control whether signers are created.
DocumentApprovalDocumentSignersPostOperationUpdate
Action: Update | Stage: Post-Operation
Updates Document Signer records when the Service Line changes on a Document Approval in Draft status. Deletes old signers and creates new ones based on the updated Service Line. Also handles changes to the "Specific Approvers" flag—when set to "No", all signers are removed.
Tax Form Management
TaxFormSectionsPostOperationCreate
Action: Create | Stage: Post-Operation
Automatically populates section fields on UK Tax Return forms when created. Loads configuration from a web resource containing section definitions and populates tt_section1, tt_section2, etc. fields with the appropriate JSON data. Enables dynamic tax form structures without hardcoding.
Utility Functions
Utils
Comprehensive Utility Library
A centralized collection of 26+ reusable methods that handle common plugin operations including:
- Assignment & Web Role Management - Configuration retrieval, web role lookups, association validation
- Document Approval Operations - Signer management, service line mapping, status validation
- Tax Form Configuration - Web resource loading, JavaScript parsing, section population
- General Utilities - Entity validation, option set label retrieval, depth checking
All documented plugins leverage Utils methods to maintain consistency, reduce code duplication, and improve maintainability across the codebase.
Plugin Architecture
All plugins follow a consistent architecture pattern:
- Validation - Validate context, entity type, message type, and plugin depth
- Configuration Retrieval - Load necessary configuration or reference data
- Business Logic - Execute the core plugin functionality
- Error Handling - Comprehensive try-catch with detailed trace logging
- Utils Integration - Leverage reusable methods from the Utils library
This standardized approach ensures:
- ✅ Consistent error handling and logging
- ✅ Prevention of infinite loops (depth checking)
- ✅ Reusable code across multiple plugins
- ✅ Easy troubleshooting with detailed trace logs
- ✅ Maintainable and testable code
Quick Reference
| Plugin | Entity | Message | Stage | Purpose |
|---|---|---|---|---|
| AssociateEntities | Contact ↔ Assignment | Associate | Post | Grant Web Roles |
| DisassociateEntities | Contact ↔ Assignment | Disassociate | Post | Remove Web Roles |
| DocumentApproval Create | tt_documentapproval | Create | Post | Create Signers |
| DocumentApproval Update | tt_documentapproval | Update | Post | Update Signers |
| TaxFormSections | tt_taxform | Create | Post | Populate Sections |
Configuration Dependencies
Most plugins depend on configuration stored in Dynamics:
- Assignment Plugins →
tt_configurationrecord named "Assignments.json" - Document Approval Plugins → Service Line option sets and Connection Roles
- Tax Form Plugins →
tt_configurationrecords and Web Resources
Refer to individual plugin documentation for detailed configuration requirements.