Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
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

  • Community Power Platform Member Profile Picture
    on at
    Re: Prevent Reactivating of a Lead according a specific criteria

    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.

  • cchannon Profile Picture
    4,702 Super User 2025 Season 1 on at
    Re: Prevent Reactivating of a Lead according a specific criteria

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

  • Community Power Platform Member Profile Picture
    on at
    Re: Prevent Reactivating of a Lead according a specific criteria

    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

  • Verified answer
    cchannon Profile Picture
    4,702 Super User 2025 Season 1 on at
    Re: Prevent Reactivating of a Lead according a specific criteria

    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?

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 87 Most Valuable Professional

#2
mmbr1606 Profile Picture

mmbr1606 71 Super User 2025 Season 1

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 67 Super User 2025 Season 1

Overall leaderboard