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 / Workaround for the lac...
Power Apps
Unanswered

Workaround for the lack of user-defined functions in PowerApps?

(0) ShareShare
ReportReport
Posted on by 37

Hi everyone,

I'm facing a challenge in PowerApps due to the lack of user-defined functions, and I’d like to know how others have worked around this limitation.

In my app, I have a search form that allows users to search for a record using different methods (ID, name, barcode scanning, RFID cards, etc.). Once the record is found in the dataset, I load it into an edit form.

The problem is that after loading the record, I need to perform multiple UI updates and validations. However, I don’t want to duplicate this logic in each of my different search routines. Ideally, I’d like to call a single function after retrieving the record to handle all the necessary UI updates in one place.

Since PowerApps doesn’t support user-defined functions, how have you tackled similar situations? Any best practices or workarounds you can recommend?

Thanks in advance!

NOTE: User Defined Functions are supported as 'experimental', so they are not safe for production environments

Categories:
I have the same question (0)
  • Verified answer
    iAm_ManCat Profile Picture
    18,228 Most Valuable Professional on at
    If you can't use experimental (hopefully it shouldn't be there much longer based on all the public blogs and news around UDF), then use a button or timer.
    Then use Select(buttonName) if you went the button route, otherwise use variables to start/stop the timer.
  • Verified answer
    ronaldwalcott Profile Picture
    3,847 Super User 2025 Season 2 on at
    What type of updates do you need to perform that would be managed by user defined formulas? Have you tried using named formulas and setting the parameters using global variables, therefore all the logic would reside in the named formula?
  • Verified answer
    developerAJ Profile Picture
    4,643 on at

    You can achieve user-defined function (UDF) logic using buttons.

    For example, if you want to add two integers as a UDF and retrieve the output, you can follow this approach:

    1. Create two variables within a button: lvar_x and lvar_y, along with lvar_id (a unique identifier).
    2. Store the output in a collection.

    To use this logic:

    • Set the context with UpdateContext({lvar_x:10, lvar_y:15, lvar_id:25}).
    • Select the button, which will calculate the values and add them to the collection using:
      Collect(col_sum, {id: lvar_id, Value: lvar_x + lvar_y})
    • Retrieve the result using Lookup(col_sum, id = 25).

    This may not be the most conventional approach, but it could work to some extent.

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