Dashboard JavaScript Library

@mark.barciak has a quick product tip for you!

Dashboard JavaScript Library

In Tip 122 - Homemade JavaScript Library, we showed how you could take advantage of the JavaScript Resource entry in Admin -> Setup -> App Styling to introduce your own JavaScript library. That library would become available to the entire App, making it easy to use. Now, what if I want a library on a single dashboard or a template instead of the entire application?

Great question!

To get started, we’ll head over to our Dashboard/Template, and chose an action to add our Script to. Both the Loading and Ready action are valid locations to have our library. In this tip, I’m going to have the TipsAndTricks library on the Ready action.

Figure 1- Script added to the Ready event, renamed to TipsAndTricks Library

Once I have the Script on the Ready action, all we have to do is open the Script Editor by clicking on the script name (in my case, TipsAndTricks Library). Once the Script Editor opens, we’ll just need to enter our library’s code, or copy and paste, and click Build to check for syntax errors.

To use our library, all we’ll have to do is add Scripts to the appropriate action on our Data Visualizations/Components.

And just like that, we have a JavaScript Library that is exclusive to our Dashboard or Template!

Pretty neat, right?