Sometimes you have a grouping of functions you need to reuse within an app. In traditional coding that’s called a class or a method. Microsoft is currently working on fully supporting this in the future, but for now I have a pretty slick work around that I think you’ll love!

The trick is to use a toggle control. Put your code block in the “OnChange” property, and set the Default property to a boolean variable. Whenever you need the function, just change that boolean variable. To use parameters in your custom function, use global variables. Add these wherever you need in the OnChange of the toggle, and then update them just before you change the trigger/boolean variable.

This is great, because you can use this code block anywhere in your app. If you need to make a change, just update the code in the toggle – you don’t have to go update it in multiple places. You might be thinking, can’t you just use a button? No. Buttons cannot be triggered from a different screen, so you’ll unfortunately still be forced to update your code block within each button.

Check out the video below to see exactly how to do this.

[wpforms_selector form_id=”2115″ show_title=”on” show_desc=”off” _builder_version=”4.6.5″ _module_preset=”default” min_height=”437px” custom_margin=”-30px|||||” custom_padding=”77px|||||”][/wpforms_selector]