Study guide
5.3 Pre/Post Images & Organization Service Operations in Plug-ins
Microsoft Power Platform Developer Associate PL-400
Track your progress as you read
Finished sections get a check mark.
1 Introduction, Exam Overview & Developer Toolchain
0.1 PL-400 Exam Facts 0.2 Audience Profile & Required Developer Skills 0.3 The Power Platform Developer Toolchain 0.4 Extension-Point Map & AI in the Developer Workflow
2 Create a Technical Design
1.1 Analyzing Technical Architecture and Choosing Out-of-the-Box vs. Custom Solutions 1.2 Designing Authentication, Authorization, and Security Architecture 1.3 Deciding Where Business Logic Runs and Choosing the Right Table Type 1.4 Designing Reusable Power Apps Components and Custom Connectors 1.5 Designing Dataverse Code Components, Automations, and Integrations
3 Build Power Platform Solutions
2.1 Managing Power Platform Environments for Development 2.2 Dataverse Security Roles for Code Components, Least Privilege & Troubleshooting Operational Security 2.3 Solutions, Managing Dependencies & Solution Layers 2.4 Environment Variables & Connection References 2.5 Power Platform Pipelines & CI/CD with Power Platform Build Tools
4 Implement Power Apps Improvements
3.1 Complex Power Fx Formulas and Functions 3.2 Building Reusable Canvas Component Libraries 3.3 Invoking Power Automate Cloud Flows from a Canvas App 3.4 Troubleshooting Canvas and Model-Driven Apps with Monitor and Browser Debugging Tools 3.5 Optimizing Canvas and Model-Driven App Performance
5 Extend the User Experience
4.1 The Client API Object Model & JavaScript Form Scripting 4.2 Event Handler Registration & Navigation to Custom Pages via the Client API 4.3 Client Scripting Against the Dataverse Web API; Command Bar & Buttons with Power Fx and JavaScript 4.4 PCF Fundamentals: The Component Manifest & Lifecycle Events 4.5 Implementing PCF Component Interfaces; Device, Utility & Web API Features 4.6 Packaging, Deploying & Consuming a PCF Component
6 Extend the Platform: Dataverse Plug-ins & Custom APIs
5.1 Plug-in Fundamentals & the Event Execution Pipeline Stages 5.2 Execution Context & Implementing Business Logic in Plug-ins 5.3 Pre/Post Images & Organization Service Operations in Plug-ins 5.4 Registering Plug-ins with the Plug-in Registration Tool & Optimizing Plug-in Performance 5.5 Custom API Messages & Plug-ins That Implement a Custom API 5.6 Configuring Dataverse Business Events
7 Extend the Platform: Custom Connectors
6.1 Open API Definitions: Building and Extending a Custom Connector 6.2 Authentication and Policy Templates for Custom Connectors 6.3 Importing Definitions and Creating Connectors for Azure Services 6.4 Azure Functions in Custom Connectors and Data Transformation
8 Extend the Platform: Platform APIs & Azure Functions
7.1 Dataverse Web API Operations & OAuth Authentication 7.2 Organization Service Operations, Concurrency, Transactions & Bulk Operations 7.3 Service Protection API Limits & Retry Policies 7.4 Azure Functions for Long-Running, Scheduled & Event-Driven Workloads 7.5 Authenticating to Power Platform with Managed Identities
9 Extend the Platform: Power Automate Cloud Flows
8.1 Dataverse connector triggers/actions, trigger filters & retry policies 8.2 Complex expressions & flow control with error handling 8.3 Sensitive input/output parameters & Azure Key Vault 8.4 Reusable child flows & Microsoft Entra ID service principals
10 Develop Integrations
9.1 Publishing Dataverse Events: IServiceEndpointNotificationService & the Plug-in Registration Tool 9.2 Registering Service Endpoints: Webhooks, Azure Service Bus & Event Hub 9.3 Data Synchronization with Change Tracking & Alternate Keys 9.4 Upsert-Based Synchronization with the UpsertRequest Message
11 Exam Readiness & Practice
10.1 Cross-Domain "Where Do I Implement This?" Decision Framework 10.2 Exam-Day Strategy, PL-400 Item Styles & Study Plan
5.3 Pre/Post Images & Organization Service Operations in Plug-ins
Key Takeaways Explain This Topic AI
Target in InputParameters only contains attributes the caller actually sent; Pre-Images and Post-Images supply the rest of a record's data before and after the core operation.
A Pre-Image captures a record's values before the operation is applied; a Post-Image captures them after -- Pre-Images aren't meaningful on Create and Post-Images aren't meaningful on Delete.
Pre-validation steps cannot use entity images at all, since they run before the database transaction opens.
IOrganizationService, obtained from IOrganizationServiceFactory, is the primary interface for a plug-in to Create, Update, Delete, Retrieve, RetrieveMultiple, or Execute any other SDK message against Dataverse.
The userId passed to CreateOrganizationService controls whether the service runs as the current user, the initiating user, or with full system privileges.
Last updated: July 2026
Not every plug-in that needs data has to query the database for it. Dataverse can hand a plug-in two ready-made snapshots of the record it's operating on -- a Pre-Image and a Post-Image -- and for anything the images don't cover, a plug-in reaches back into Dataverse itself through the Organization service . Both mechanisms exist to solve the same core limitation: InputParameters["Target"] only contains the attributes the caller actually sent, which is frequently not the whole record.
Why Target Alone Isn't Enough
If a user changes only a phone number on an Update, Target contains just telephone1 -- none of the record's other fields are present, because the caller never sent them. A plug-in that needs to compare the new value of a field against its old value, or that needs a field like revenue to run a calculation regardless of what the caller actually edited, cannot get either value from Target alone. That's what entity images solve.
Pre-Images and Post-Images
An entity image is a snapshot of a record's attributes that Dataverse captures and hands to the plug-in alongside the execution context. Images are configured per registered step (in the Plug-in Registration Tool, 5.4), each given a friendly alias -- the string key used to retrieve it in code -- and optionally restricted to a specific set of columns to avoid pulling the whole record.
- Pre-Image Post-Image
- Snapshot taken Before the core operation applies changes After the core operation applies changes
Reflects The record as it existed in the database prior to this request The record as it will be saved, including defaulted and calculated fields
- Valid on Update, Delete (and other messages with an existing record) Create, Update
- Not meaningful on Create (no "before" record exists) Delete (no "after" record exists)
- Available to Pre-operation and post-operation steps Pre-operation and post-operation steps
Note that pre-validation steps cannot use images at all -- pre-validation runs before the database transaction opens, ahead of the point where Dataverse can reliably construct either snapshot.
In code, images arrive as dictionaries on the context, keyed by the alias registered for that step: Entity preImage = context.PreEntityImages["PreImage"];
Entity postImage = context.PostEntityImages["PostImage"];
decimal oldRevenue = preImage.GetAttributeValue<Money>("revenue")?.Value ?? 0m;
A common exam scenario: "a post-operation plug-in on Update needs to compare a field's old value to its new value." The answer is a Pre-Image registered on that step -- the new value is available directly from Target or the Post-Image, but the old value only exists in the Pre-Image, because Target won't contain it unless the caller happened to resend it.
The Organization Service
For anything beyond what images provide -- querying unrelated tables, writing to other records, calling other messages -- a plug-in uses IOrganizationService , obtained through IOrganizationServiceFactory : IOrganizationService service = factory.CreateOrganizationService(context.UserId);
The userId argument controls whose security context the service runs under: pass context.UserId to run as the user Dataverse is currently processing the request as, respecting that user's security roles and business unit; pass context.InitiatingUserId to run as whoever originally triggered the request chain; or pass null to run with full system privileges, the equivalent of the SYSTEM account, used sparingly since it bypasses the security-role checks the platform would otherwise enforce.
IOrganizationService exposes the same core operations available anywhere in the SDK:
- Create(Entity) -- returns the new record's Guid
- Update(Entity) -- saves only the attributes present on the Entity object
- Delete(string logicalName, Guid id)
Retrieve(string logicalName, Guid id, ColumnSet columns) -- always pass an explicit ColumnSet , never ColumnSet(true) , so the call doesn't pull every column on the table
RetrieveMultiple(QueryExpression or FetchXML query) -- for querying by criteria rather than by ID
Execute(OrganizationRequest request) -- the general-purpose entry point for everything that isn't basic CRUD: WhoAmIRequest , AssignRequest , SetStateRequest , calls to custom APIs (5.5), and any other SDK message
Because a plug-in already runs inside an active transaction, calls made through IOrganizationService from within it participate in that same transaction for synchronous steps -- a later failure and rollback undoes writes the plug-in itself made during the same execution, not just the original triggering operation. That transactional coupling, combined with the Depth counter from 5.2, is exactly why a plug-in that calls Update on the same table it's handling Update for needs to guard against re-entering its own pipeline.