A synchronous PostOperation plug-in on Update of the case table sets Target["cr5a2_lastreviewed"] to the current time. The plug-in runs without errors, but the column is never saved. What is the correct fix?
Select an answer to reveal the explanation.
Short Explanation
By PostOperation the core update has already happened, so editing Target is like editing a receipt after you've paid. Move the change to PreOperation, or send a real Update. Images and async mode won't make a dead edit come back to life.
Full Explanation
Target in InputParameters is the request data. Changes to it are picked up by the core operation only when made before MainOperation runs, which means PreValidation or PreOperation. In PostOperation the data has already been written, so modifying Target changes an in-memory object that nothing reads again, which is why the plug-in runs cleanly yet nothing is saved. The fix is to move the assignment to PreOperation, the preferred option because it avoids a second write, or to call IOrganizationService.Update in PostOperation when the value depends on the result of the core operation. Adding Target to OutputParameters does not cause a write; output parameters carry the response to the caller. A post-image is a read-only snapshot of the row after the operation and has no effect on what is saved. Asynchronous steps run after the transaction commits, and editing Target there has the same lack of effect, so changing the mode does not help. Exam caveat: an explicit Update in PostOperation can trigger the same step again, so it needs filtering attributes or a Depth check. Operational check: move the step to PreOperation, update a case, and confirm cr5a2_lastreviewed is populated in the saved row.