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