Question 1
A developer is creating a Dataverse plug-in that must execute custom logic when an account's primary contact is changed. The logic requires access to both the previous primary contact's ID and the new primary contact's ID to perform a hand-off process in an external system. The plug-in is registered on the 'Update' message of the 'account' entity. Which is the most efficient method to access both the old and new primary contact GUIDs within the plug-in's execution context?
Answer and explanation
Correct answer: C
The most efficient and correct method is to use a Pre Image. By registering a Pre Image with the required attribute (primarycontactid), the plug-in execution context will contain a snapshot of the record before the update. The Target entity in the InputParameters will contain the new value being set. This avoids an extra API call to the database, making it the most performant and standard approach. Retrieving the record again in a post-operation step or querying the database in a pre-operation step introduces unnecessary overhead and potential race conditions.