Knowledge Base Article

Create A Plugin To Run Scripts For All Dashboards

Here are the steps:
1) Create a new plugin.
2) Open widget.js for editing.
3) In this file, we'll use the dashboardLoaded event to register the logic when the dashboard finished loading. For example, if we'd like to remove the new widget button if the logged in user is a designer:
// registering the event handler
prism.on("dashboardloaded", function(){
    
    if (prism.user.roleName == 'contributor'){
        
        $('.new-widget').remove();
        console.log("Designer logged in -> new widget button removed");
    }   
});
Updated 02-07-2024
No CommentsBe the first to comment