Skip to main content

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:

  1. Validation - Validate context, entity type, message type, and plugin depth
  2. Configuration Retrieval - Load necessary configuration or reference data
  3. Business Logic - Execute the core plugin functionality
  4. Error Handling - Comprehensive try-catch with detailed trace logging
  5. 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

PluginEntityMessageStagePurpose
AssociateEntitiesContact ↔ AssignmentAssociatePostGrant Web Roles
DisassociateEntitiesContact ↔ AssignmentDisassociatePostRemove Web Roles
DocumentApproval Creatett_documentapprovalCreatePostCreate Signers
DocumentApproval Updatett_documentapprovalUpdatePostUpdate Signers
TaxFormSectionstt_taxformCreatePostPopulate Sections

Configuration Dependencies

Most plugins depend on configuration stored in Dynamics:

  • Assignment Pluginstt_configuration record named "Assignments.json"
  • Document Approval Plugins → Service Line option sets and Connection Roles
  • Tax Form Pluginstt_configuration records and Web Resources

Refer to individual plugin documentation for detailed configuration requirements.