Good Day
I have a scenario where a Lead gets qualified and an Opportunity is created and linked to the Lead. The Leads gets marked as won and Deactivated.
I have a requirement where the Lead needs to reactivated to captured additional custom details after it was won/disqualified. But the Lead cannot be Reactivated if the Source Campaign is not Active and not more than 30 days after it was closed.
I'm trying to use a Plugins on the following messages. Lead -> SetState, SetDynamicState on the Pre Validate/Pre Operation and then logic to be executed on the Post SetSate operation.
But when marking the Lead as Won/Disqualified these events are not executing and even on the QualifyLead message it is not firing.
Also tried on the Pre Update message linked to the statecode field.
Am I missing something? Or are there a better way of applying logic when Deactivating/Reactivating of Leads?
Thank You Kindly
A big thank you for everyone's help.
I created a Pre Validate plugin on the Lead Entity. And then I do my checks and then throw an InvalidPluginExecutionException. And that works PERFECTLY.
Great. If it works, come back and let us know!
Will remove all the SetState messages from the Plugin, and redo my Pre Validate/Pre Operation and Post Operation messages and link them to only fire on the statecode field of the Lead Entity.
Thank You Kindly
The SetState message, like the Assign message, was deprecated years ago (2017, I think?); it just has such deep roots that to this day it is still visible and accessible. You are better off pretending that the message doesn't exist and trying to catch its events only on Update.
Did you try the PreValidate of Update to see if you can cleanly intercept it there and prevent Dataverse from ever even considering the permissions involved?
WarrenBelz
87
Most Valuable Professional
mmbr1606
71
Super User 2025 Season 1
Michael E. Gernaey
67
Super User 2025 Season 1