How to use formula in Business Rules for Automations in Dataverse/ Dynamics 365
Follow my blog for more trending topics on Dynamics 365, Azure, C#, Power Portals and Power Platform. For training, Courses and consulting, call to us at +91 832 886 5778 I am working more for community to share skills in Dynamics 365 and Power Platform. Please support me by subscribing my YouTube Channel. My YouTube Channel link is this : https://www.youtube.com/user/sppmaestro
Business Rules is a game changer and we all know it. With out writing JavaScript and C# code plugins we just just configure to automate/validate many business logic using Business Rules. In this post I will tell you how you can leverage Business Rules using formula.
Business Requirement:
Calculate hourly rate of course by using Payment and Duration. Now for this requirement we can write JavaScript but without writing code we can do it using Business rule although it requires formula. Lets see how we can do this.
Step:1- Configure Business Rule
Login Power Apps and go to table. Open the table and select Business Rules. Click on Add business rule and it will open business rule designer.
Now provide the name of business rule and description then select scope as Entity. you can also use All Forms as scope. Its as per business.
- Entity : The rule will be applicable client side and server side
- All Forms : The rule will be applicable client side only and for all forms.
- Specific Form : The rule will be applicable client side only and for single form.
Now click on condition component box on the designer and supply the details about the condition like we only want to calculate price per hour if price and duration is not blank. so build the condition as below:
Add new rule to check if Price contains data. and add another rule to check if duration contains data then choose Rule Logic as AND. Then click Apply.
Now our condition is built. This condition will satisfy when either duration and price contains some data.
Next Select Component panel from right panel and drag towards tick symbol direction and drop it. Click on the Set Field value action and set properties.
Now set the property of set field action. Choose Field as Per Hour Charge, the field you want to update. Select Type as Formula, Field Cost and Operator as division, Type as Field and then choose Duration. Click Apply.
Now Save and Validate, Activate the Business Rule.
Now we will test.
Open Course Form and create new record and provide Duration, Fees now you will see the price per charge is calculated.
hope this helps.
Follow my blog for more trending topics on Dynamics 365, Azure, C#, Power Portals and Power Platform. For training, Courses and consulting, call to us at +91 832 886 5778 I am working more for community to share skills in Dynamics 365 and Power Platform. Please support me by subscribing my YouTube Channel. My YouTube Channel link is this : https://www.youtube.com/user/sppmaestro