PL-400 practice question 31 of 35

A company develops a new Microsoft Dataverse plug-in that manages the Update message of an entity. The plug-in logic requires access to the record columns before the operation starts and must compare the columns to post-update values. You need to modify the design of the solution to access the information. What should you do?

Full set: 391 questions

Domain Extend the platform

Answer options
A: Add the code to the plug-in to read the record from the InputParameters collection.
B: Register a pre-image by using the Plug-in Registration Tool. Add the code to the plug-in to read the image from the PreEntitylmages collection. Correct answer
C: Register a post-image by using the Plug-in Registration Tool. Add the code to the plug-in to read the image from the PostEntitylmages collection.
D: Add the code to the plug-in to query the data from Dataverse by using the API call based on the record ID.
Correct Answer:
B. Register a pre-image by using the Plug-in Registration Tool. Add the code to the plug-in to read the image from the PreEntitylmages collection.
Explanation

To access a record's column values as they were before an update operation, the standard and most efficient method is to use a pre-entity image. A pre-entity image is a snapshot of the record taken before the main database transaction occurs. By registering a pre-image for the Update message step, the plug-in's execution context will be populated with this snapshot. The plug-in code can then access this snapshot from the IPluginExecutionContext.PreEntityImages collection to retrieve the pre-update values for comparison against the new values.

Why Incorrect

A. The InputParameters collection's Target property for an Update message only contains the specific attributes that are being changed, not the full record state before the operation.
C. A post-image is a snapshot of the record after the main operation has completed. It provides post-update values, not the pre-update values required by the scenario.
D. Querying Dataverse via an API call within the plug-in is inefficient. It introduces extra latency and API consumption, whereas entity images provide the same data directly within the execution context.

References

1. Microsoft Docs, Dataverse > Developer > Use entity images with plug-ins:

Section: "Pre-entity image": "This is a snapshot of the entity before the core platform operation. We also call this the 'before' image... You can access this image in your code from the IPluginExecutionContext.PreEntityImages property." This directly supports using a pre-image to get the "before" state.

Section: "Register an image": This section details the process of using the Plug-in Registration tool to configure a pre-image for a specific plug-in step, confirming the procedure described in the correct answer.

2. Microsoft Docs, Dataverse > Developer > Event framework:

Section: "Event execution pipeline": This document explains the plug-in pipeline stages. It clarifies that for an Update message, the Target parameter in the InputParameters contains an Entity instance with only the properties being updated, which supports why option A is incorrect.

Section: "IPluginExecutionContext": The documentation for the execution context explicitly lists the PreEntityImages and PostEntityImages collections as the means to access snapshots, reinforcing that this is the intended design pattern.

Scroll to Top