Common Javascript Functions as Static Resource

Hi Mark, it looks like you’re registering your snippet correctly in your static resource and connecting to it appropriately as a Javascript resource in your Skuid page.

The docs don’t have a specific example of calling a custom function stored in a static resource from an inline snippet, but I’d say keep doing what you’re doing since it works. I’ll check in with the internal team to see if I can get more information about best practices here.

In case you haven’t seen the docs on this, you can check them out here: https://docs.skuid.com/latest/en/skuid/javascript/resource-types/#static-resource.

As a general best practice, we recommend storing most JS as a static resource since it’s more efficient and improves the page’s load time. From Skuid and Code:

"If you’re consistently using a piece of code—such as a JavaScript snippet—if you’re building a component pack for your custom component, or if you’re an ISV developing a managed package, you should store that code within a Salesforce static resource

  • . Static resources are the most dependable way to use code in conjunction with Skuid, and they have a variety of advantages:

    Static resources can be cached, leading to lower page load times.

  • They can be stored in a source control repository _separate_ from your Skuid pages."