Study FAQ
How do I validate a partial Dataverse Update with a plug-in pre-image?
Also asked as 2
- How should a Dataverse plug-in compare a changed field with an unchanged field?
- How do I use a Dataverse pre-image without ignoring an explicit null in the Update Target?
Answer
For each field used by the rule, take the value from the Dataverse Update Target when its attributes contain that field, including when the submitted value is null. Read the value from the registered pre-image only when the field is absent from the patch. This lets a partial Update reuse unchanged stored values while still detecting a request to clear a required field. Dataverse execution context
Register the pre-image on the target Update step with the alias expected by the code and select the columns the comparison needs. In a maintenance-window rule, a patch that supplies only the end timestamp can be compared with the old start timestamp. Treat a missing image alias as an incomplete registration. A Create has no earlier row, so get both values from its input. A post-image is available only for supported messages in PostOperation, and Delete has no post-image. Use the parameter contract of the registered message because Target can have different types on other messages. Dataverse plug-in registration and images
In a development table with agreed date/time semantics for both columns, test a valid one-field change, an invalid one-field change, a request that clears a timestamp and a request that supplies both. Compare persisted values after each rejection and success. Write a Dataverse plug-in
Full explanation
AB-400: Dataverse Plug-ins and the Event Execution Pipeline
Study guide · AB-400
Read the full explanation