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

Community site session details

Session Id : pGqROkEFKIJZWgVry9LrpX
Power Apps - Microsoft Dataverse
Answered

How to run a new business rule on existing data?

Like (0) ShareShare
ReportReport
Posted on 23 Mar 2020 21:18:20 by

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.

Categories:
I have the same question (0)
  • mdanish Profile Picture
    4 on 03 Jan 2023 at 16:32:09
    Re: How to run a new business rule on existing data?

    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.

  • Verified answer
    v-siky-msft Profile Picture
    on 25 Mar 2020 at 01:41:11
    Re: How to run a new business rule on existing data?

    Hi @Anonymous ,

     

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

    Does ForAll/Patch function make sense for your case?

    Sik

  • Community Power Platform Member Profile Picture
    on 24 Mar 2020 at 10:56:06
    Re: How to run a new business rule on existing data?

    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.

  • v-siky-msft Profile Picture
    on 24 Mar 2020 at 06:30:57
    Re: How to run a new business rule on existing data?

    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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 936 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 375 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 330 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics