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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Business Rule not trig...
Power Apps
Answered

Business Rule not triggering in Power Apps | Can Values of Choice Data Type be used in Business Rule

(0) ShareShare
ReportReport
Posted on by 231

Hi, I have 2 queries:-

1. I have created a business rule. However, i am observing that 2nd action i.e to Show error message that "To Date" value can't be less than "From date" value. is not getting reflected when i run the app. Only 1st action i.e. to "Clear the filed" for "To Time" is getting reflected. The screenshot of Business rule is 1.png and the same not reflected while playing the app is in 2.png.

1.PNG

2.PNG

Should i create 2 business rules to resolve the issue?

2. My second query is that whether i can use the "value" of Choice Field in Business Rule. As explained in screenshot below, i want to use the value i.e. 138200000 for Choice Label 00:00 and so on. Right now, i can only see the Labels and not the values while creating Business Rules. Is there some way/?. Please see screenshot 3.png.

3.PNG

 

I have the same question (0)
  • Parvez Ghumra Profile Picture
    1,579 Moderator on at

    1. I think it is the action that is clearing the 'To Date' value which is causing your Business Rule to trigger again, and therefore not showing the error message. I would recommend to remove the action which clears the 'To Date' field, forcing the user to change the value themselves.

    2. Why would you want to use the value of the Choice option in the Business Rule? It will make it much more harder to maintain from a customiser/maker/developer perspective. You should try to use the label of the option in your conditions/actions in the Business Rule.

  • SA_VOH Profile Picture
    231 on at

    HI parvezghumra,

    1. I acted as per your recommendation and found it ok. Thanks. I will accept it as solution shortly.

    2. However, for S. No.2, i want to use "Value" field because i am unable to find a way through which i can restrict a user to enter a "To Time" value which is less than "From Time" value.

    Eg:- If From Time is say 08:00 hours then To Time can't be less than 08:00 hours. But how would Power Apps come to know this logic. I think this is possible only through respective value fields.

    Please advise accordingly. 

  • Parvez Ghumra Profile Picture
    1,579 Moderator on at

    @SA_VOH 

     

    Regarding 2: Ah, ok, I see what you mean now. You won't be able to achieve this with a Choice field combined with a Business Rule. Perhaps the easiest way to achieve the same effect would be:

     

    1. Create a custom table called 'Time Slot'. The primary name field of this name should be used to hole the time in HH:MM format. Add another column to this table of Whole Number type, call it "Value". Created records in this table for each of your selectable time slot options, ensuring you assign a unique, sequential, value in the "Value" column for each record.

    2. Replace your "From Time" and "To Time" Choice columns, with new "From Time" and "To Time" lookup columns that target the new custom "Time Slot" table.

    3. Modify your Business Rule to work off these Lookup columns instead, comparing the value of the "Value" associated with the "From Time" and "To Time" selected.

  • Verified answer
    SA_VOH Profile Picture
    231 on at

    Hi, 

    Your advice for point No.2 is ok and may be workable, but since I have gone far ahead and created App which are dependent on Time Slot- Choice Column which is already created, i would not like to go through the entire process.

    But i am thankful for your valuable advice and keep it in future.

  • Parvez Ghumra Profile Picture
    1,579 Moderator on at

    @SA_VOH No worries, in that case your only option is perform the "From Time" is before "To Time" validation using code (ie. JavaScript or plugin) rather than Business Rule as these will allow you to perform the validation on the basis of the underlying numeric value.

  • SA_VOH Profile Picture
    231 on at

    Hi parvezghumra,

    If you can please help me with Javascript, kindly provide me.

    Right now, i am good at Power Automate only, wherein i can do following:-

    1. When a row is added or modified in Dataverse

    2. Parse JSON

    3. Extract "From Time" and To Time values from Parse JSON output.

    4. Applying If logic to check if "From Time is less than To Time.

    5. But what to do next? Send an email action, will send a email to me. I can then correct the issue, post facto. But How to stop Power Apps from doing incorrect entry in the first place, itself.

  • Parvez Ghumra Profile Picture
    1,579 Moderator on at

    @SA_VOH Unfortunately, for this use case Power Automate would not be a good fit because it would run asynchronously and you need some real-time data validation.

     

    If you plan to implement this using JavaScript, here's a great walkthrough example for writing form scripts for Model Driven Apps. It won't fulfil your exact requirement, but should hopefully give you an idea of what you need to do: https://learn.microsoft.com/en-us/power-apps/developer/model-driven-apps/clientapi/walkthrough-write-your-first-client-script

     

    Likewise, if you intend to build a server-side plugin to perform this validation, there's some documentation to get you started here: https://learn.microsoft.com/en-us/power-apps/developer/data-platform/write-plug-in

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 536

#2
WarrenBelz Profile Picture

WarrenBelz 426 Most Valuable Professional

#3
Haque Profile Picture

Haque 305

Last 30 days Overall leaderboard