cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
omaranfer
Regular Visitor

Business rules from 2 entities

Hi community,

 

  i have create 2 entities : Contract entity  ( with total quantity field TQ )and Quantities (with quantity field)  with a relation 

omaranfer_0-1615152404944.png

how to setup the business rule : Q1+Q2+...+Qn=< TQ ? 

 

Thank you 

 

4 REPLIES 4
v-xiaochen-msft
Community Support
Community Support

Hi @omaranfer ,

 

Could you tell me:

Where do users submit data? 

 

I assume that users submit data using canvas app.

 

Firstly, business rule may not be able to achieve your needs.

However, you can use the canvas app to meet your same needs.

 

Please refer to the steps below:

1\ This is my table 'Test 77'.

v-xiaochen-msft_0-1615170337270.png

 

2\ This is my table 'Test 888'.

v-xiaochen-msft_1-1615170383069.png

 

3\ Add a textinput control 'TextInput1' .This control allows the user to enter a number. The number is the value of the quantity column.

 

4\ Add a button control in canvas app and set its onselect property to:

If(Sum('Test 888S',quantity)+Value(TextInput1.Text)<=First('Test 77S').Total,Patch('Test 888S',Defaults('Test 888S'),{Name:"Test",quantity:Value(TextInput1.Text)}),Notify("error",NotificationType.Error))

 

5\ The result is as follows:

v-xiaochen-msft_4-1615170989598.png

 

v-xiaochen-msft_2-1615170951987.png

v-xiaochen-msft_3-1615170967127.png

 

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

 

 

 

Hi, 

Thank you for your answer. 

Sorry but  didn't give you precisio about how i submit data, I'm using a model driven apps. 

When I add a new Quantity in the quantities Table, I have to verify if the TQ >= Q1 + Q2 +...+Qn if not I have to display an error message.

 

Regards

v-xiaochen-msft
Community Support
Community Support

Hi @omaranfer ,

 

Business rule is difficult to achieve your needs.

You could embed the canvas app I mentioned above into the model driven app.

The user uses the embedded canvas to submit data instead of the submit button that comes with the model driven app.

 

Another method is flow.But it will first create a record and then judge whether the record meets the conditions.

If the record meets the conditions, the record will be kept.

If the conditions are not met, the record will be deleted automatically.

 

There is a disadvantage of using flow. If the user enters the wrong information and submits it, after the flow deletes the record, it cannot directly display the error message in the model driven app.

You can remind users by sending emails to users(use flow ).

 

You could choose one from two methods.

Then I will provide you with specific solutions.

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

Hi @v-xiaochen-msft 

 

  Thank you for you anwser.

  I think that the solution will not fit from the UX perspective, because the user has to submit twice the same form.

  I'm thinking if I have to implement a portal solution, but I wonder if I can use a business process in a portal solution ? 

  

  Regards 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (48,867)