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 / How to run a new busin...
Power Apps
Answered

How to run a new business rule on existing data?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I'm not sure if this is possible but what I"m trying to do:

 

I have 4 different image fields. In my canvas app I want to be able to lay them out differently depending on if the user has uploaded 1, 2, 3, or 4 images. So to this end I've created a countImages field and am trying to use a business rule to set its value. The business rule logic is basically.

 

If image4field contains data, set countImages to 4, elif image3field contains data, set countImages to 3 etc...

 

So I created and activated the business rule and nothing happens. How do I kick this off? I know I can create this logic on the app side but I thought it would be simpler on server side. I was hoping to put this logic in one place instead of in 6 or 8 different buttons all over the app.  Thanks in advance.

I have the same question (0)
  • v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    The business rule only takes effect on the newly created records. Could you please try to create a new record and then check if the business rule works?

    In order to generate corresponding 'countImages' values to previous records based on the conditions you mentioned, you can implement this in PowerApps via ForAll functions.

    Please try this code, replace the Entity Name, four Image Field Names, and GUID Field Name to the real names.

     

     

    Clear(Col1); ClearCollect(MyCol, 'Entity Name');
    ForAll(MyCol, If(!IsBlank(ImageField1),Collect(Col1,"1"));If(!IsBlank(ImageField2),Collect(Col1,"1"));If(!IsBlank(ImageField3),Collect(Col1,"1"));If(!IsBlank(ImageField4),Collect(Col1,"1"));Patch('Entity Name',LookUp('Entity Name',GUIDFieldname=MyCol[@GUIDFieldname]),{countImages:CountRows(Col1)});RemoveIf(Col1,true))

     

     

    When previous records are successful, you can continue to automatically assign countImages values to new records by the business rule.

    Hope this helps.

    Sik

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Business rules only run on newly created? Does it not run when a record is updated?

     

    I can't use a collect to grab everything, I might be able to run a forall, patch command to trigger the business rule with a record update.

  • Verified answer
    v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    Yes, Business rules also work when a record is updated or created!

    Does ForAll/Patch function make sense for your case?

    Sik

  • mdanish Profile Picture
    4 on at

    My best workaround for this is to export the table to a Excel or CSV file, do a bulk delete job in the Power Platform Admin Center to clear the table, and then import the data back into the table. Business rules will then kick in on the data you import back in to the table.

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