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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch Function and Bus...
Power Apps
Unanswered

Patch Function and Business Rules

(0) ShareShare
ReportReport
Posted on by 58

Hi guys, i have one question about business rules on entities. I need to Patch some data using canvas app OnSelect property that have some required fields, but have a scenario when the user isn't need to populate this fields.

 

In my entity table I have this fields as required, so when the canvas try to Patch will appears required error message, okay ...

 

My question is: Can I create business rules to "When a field is set with 'Yes' option, the required field of the field is removed"?

 

I tried to do some like this but nothing changes in canvas app.

 

*Im using Defaults entity to Patch the data, if helps in something ...

Categories:
I have the same question (0)
  • Verified answer
    CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Pinguito the answer is very simple. Business Rules are not supported in Canvas Apps. Recently I had a conversation about this with someone from MS who confirmed it. 

  • Pinguito Profile Picture
    58 on at

    Do you know other way? I didnt want make them optional 

  • nickellis74 Profile Picture
    432 Moderator on at

    I can't see a way around making it optional in the data source, then use fx formulas to control the behaviour in the app.

     

    On the screen.onVisible put

    Set(_Validated,true)

     

    Do something with the border formatting of the text box like

    // Black if validated, red if not
    If(
     _Validated,
     RGBA(0,0,0,1),
     RGBA(255,0,0,1)
     )

     

    On the 'submit' button put something like 

    If(
     IsBlank(TextBox.Text) && (whatever your other requirement is),
     Set(_Validated,false);
     Notify("You have not completed the text box",Warning),
     Patch(Data Source, Defaults(Data Source), {table content})
     )

     

    I have to say though, if it's a Yes/No field which is set to Yes, I don't see the value in making it non-mandatory. The Yes you've entered will meet the requirement. Unless you mean "field a is required unless field b is Yes"?

     

    Nick

  • Pinguito Profile Picture
    58 on at

    Hi @nickellis74 , thanks for your reply.

     

    In canvas app its okay, I have made all necessary validated to make sure the data. I'm not worry about this.

     

    My curious was about the back-end, if was possible to do something like this.

     

    Thank very much (:

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Pinguito You can use Calculated and Rollup to do some server side logic. For example, you have a Date of Birth field and an Age field, you can calculate the Age based on the Date of Birth.

    CNT_0-1622129763012.png

    The other way to do validations within Canvas App Forms is to use the Valid function.

    Also, you can use the Match function to validate the format of certain fields. For example you can check if the user has entered a valid email address etc.,

     

    Hope this helps!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard