Canvas Apps UDFs - A Tiny UDF Playbook
Stop Repeating Yourself in Canvas Apps - A Tiny UDF Playbook
Stop Repeating Yourself in Canvas Apps - A Tiny UDF Playbook
Youβve probably copied and pasted the same 5 to 10 line formula across multiple screens or controls, tweaking a variable name each time. Months later, you fix a bug... in nine places... because you've actually forgotten about the 10th. Thatβs the sign you needed a user-defined function!
UDF is a named formula with input and output properties that you can call like any other function. Store them in App.Formulas and reuse for each app you are building.
Why bother:
π DRY programming (Don't Repeat Yourself): one source for fragile logic (division guards, environment lookups, patch operations)
π Readability: 10 10-line snippet can become one function everywhere
π Onboarding: a new developer can more easily understand what you create
π Refactors: enhance once, app updates everywhere
In most cases, I'm recommending the following implementation naming convention:
π udf - User-defined Function Non-Behavioural - function with input parameters/output, such as udfGetEnvironmentVariable or udfGetInitials; executes in runtime
π udfb - User-defined Function Behavioural - function with input parameters/output, such as udfbPatchDatabase; executes as a behavioural action and uses {} in code definition.
π fm - App Formula - reusable non-behaviour function without any input parameters, such as fmIsStudioMode; executes in app runtime
This is a post miniseries - 4 ready-to-use samples will be published daily!
Browse articles