cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CamFi
Frequent Visitor

Restricting Active rows in Model-driven power app

Hi, i have created a power app with a 1:N relationship between Account and Contracts. The Account can have many contracts, but i want to restrict so there only can be one contract 'active' at a time. Iv'e search around but haven't had the luck of others asking about the same scenario. 

 

thanks i advance. 

2 REPLIES 2
StalinPonnusamy
Community Champion
Community Champion

Hi @CamFi 

 

As you mentioned, Contracts have many and there is no easy way to restrict them. The solution is to create a plugin (c#) and register them in the pre-validation Stage with Sync using XrmToolbox or Plugin Registration tool.

 

Pre-validation is the first stage that executes before the main system operation and outside the database transaction.

Your plugin logic whether any existing active contracts exist before you save. If exists stop saving the record.

 

Microsoft article for the plugin stages.

 

Please let me know if you more information on this to help with this.


Thanks,
Stalin - Learn To Illuminate

CamFi
Frequent Visitor

 

I will try using plug-in and let you know how it goes!

Thank you for the reply,

Camille

 

 

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,646)