In my custom extension, I have a helper function i...
# ask-stanley-ai
e
In my custom extension, I have a helper function in the entrypoint file after mountoApp. How can i access that helper function in all the views associated with that entry point?
c
AI generated answer (using internal Slack threads):
To access a helper function in all the views associated with an entry point in your custom extension, you can define a helper object to handle your functions. This helper object can act like a switch, where you pass the type and parameter and it uses the right function dynamically. These functions can also be outside the script in a shared or common module. Here is a simplified example of how you might structure this:
Copy code
javascript
define('MyExtension.Helper', [], function() {
    'use strict';

    return {
        myHelperFunction: function(param1, param2) {
            // Your helper function logic here
        }
    };
});

define('MyExtension.View', ['MyExtension.Helper'], function(Helper) {
    'use strict';

    return {
        someViewFunction: function() {
            // You can now use your helper function in this view
            Helper.myHelperFunction(arg1, arg2);
        }
    };
});
In this example,
MyExtension.Helper
is a custom module that contains your helper function. This module is then included as a dependency in your view (
MyExtension.View
), allowing you to use the helper function within that view. Remember to redeploy your SuiteApp after making these changes to ensure that the updated scripts are loaded. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.783733368
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.77997607
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.774080575
Please provide your feedback on this answer.