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

Notifications

Announcements

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

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
    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
    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 402

#2
WarrenBelz Profile Picture

WarrenBelz 380 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 293 Super User 2025 Season 2

Last 30 days Overall leaderboard