The go-to way to run scripts in UI Builder, and therefor in Next Experience and Configurable workspaces, is by writing sys_ux_client_scripts
.
Sometimes you have code that you want to re-use across sys_ux_client_scripts
. In those cases you can encapsulate that code in a sys_ux_client_script_include
and include it in multiple sys_ux_client_scripts
. Here's how.
sys_ux_client_script_include
// Scope: my_app
const helloWorld = () => {
console.log('Hello World');
};
return {
helloWorld
}
sys_ux_client_script
const { helloWorld } = imports['my_app.MyScriptInclude'];
helloWorld(); // Output: Hello World