web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Prevent Reactivating o...
Power Apps
Answered

Prevent Reactivating of a Lead according a specific criteria

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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

I have the same question (0)
  • Verified answer
    cchannon Profile Picture
    4,702 Moderator on at

    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?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    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

  • cchannon Profile Picture
    4,702 Moderator on at

    Great. If it works, come back and let us know!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 525 Most Valuable Professional

#2
Haque Profile Picture

Haque 308

#3
Kalathiya Profile Picture

Kalathiya 234 Super User 2026 Season 1

Last 30 days Overall leaderboard