top of page

The Challenge

A problem similar to the New/Delete profile but multiplied by N factors. In creating or deleting a profile, I must also create/delete a row of 37 items on another list. This one is the same because I need pick one profile and update 37 rows of items multiplied by N number of profiles. The way I pick the profile that I want to update is with a profile with similar job roles. A profile with a job role of "Developer" or "Project Manager". I must take all those profiles and update all accompanying rows from another list.

The Solution

There are two main branch of solutions. Stay within PowerApps and have it update using the Patch() function or create a flow and have Power Automate do the updating.

When the user navigates on this screen a function runs during the onvisible event. This adds all accounts from Employee to a collection.

This is how the job roles are shown in the Drop down menu

Solution #1

These are the codes for updating all rows require without leaving PowerApps.

​

  1. Clear the collection colTargetLevel

  2. Add all the data from the slider from the gallery control TargetGallery into the collection

  3. Run a loop for all employee in the collection colJobRoles
    NOTE: colJobRole is populated during onvisible event of the screen & the onchange event of the drop down control JobRoleDD

  4. Run another loop inside the first loop to update each row. Codes are in the image.

Solution #2

The image includes a commented section of the codes. That is how to use a Power Automate flow to update all the rows associated to the profile.

In my example I used 21 profiles to be updated. The code in the image will call and run the flow Update_TL 21 times. Now the way Power Automate behaves, the flows will run in a queue. Depending on your account premiums MS-PA will run unlimited concurrent flows or a default of 25 at the same time. This will take some time to reflect the changes on the list depending on how many rows it will update and how many flows it will run.

The flow takes 2 parameters of text from PowerApps. First is the ID of the employee account and the other is a JSON text of the colTargetLevel collection.

​

NOTE: Yes I could do this calling this flow just once by passing the colJobRole collection as a JSON too. I chose this method to take advantage of the concurrency of running flows. (parallel flow runs)

​

  1. Flow takes the ID and JSON text of colJobRole.

  2. Left: Get all items associated with the ID from Employee Skills List.
    Right: Convert JSON text into an array object.

  3. Apply to each items on the left.

  4. Apply to each item on the right

  5. Check if items have the same skill number as the array  object.

  6. If check condition is true then replace the current item "Target Level" column.

​

This will take a few minutes to complete

Conclusion

In this problem the integration of flows in Power Automate is just way superior than solving it all in PowerApps. Although there is a downside in using the flow as it will not immediately update the list rows in Employee Skills, the upside is that it will run in the background.

If I use PowerApps here then it will take freeze the user in the screen while the function runs and will overall take longer than the using actual flows through Power Automate.

Non Copyrighted © 2024 Designed and created by me

bottom of page