web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Adding script to entir...
Power Apps
Answered

Adding script to entire model-driven-app, not just a form?

(0) ShareShare
ReportReport
Posted on by 255

I have a JS file with this:
Xrm.App.sidePanes.createPane({
title:"Contacts",
paneId:"ContactList",
canClose:false
}).then((pane)=>{
pane.navigate({
pageType:"entitylist",
entityName:"contact",
})
});

It works when I use dev tools. I know its possible to target a model-driven apps onLoad, but I don't know how to get there or how to add it yet, as this is my first time. Has anyone done this before and is willing to help here?

Categories:
I have the same question (0)
  • ChannelDevMike Profile Picture
    255 on at

    So after adding it to just a form, it then remains open for entire app.. So if I can add a script to the dashboard, that will also work. 

  • Verified answer
    EricRegnier Profile Picture
    8,720 Most Valuable Professional on at

    Unfortunately, up to now it is not yet possible with the client-side API. Here are the available events/scripts available on the model-driven apps: https://learn.microsoft.com/power-apps/developer/model-driven-apps/clientapi/reference/xrm-app?WT.mc_id=DX-MVP-5004271 

     

    There is a trick however by having a dummy ribbon button but this will only be onload of every form, and not work in other areas like custom pages. Here's a nice article: https://xrmtricks.com/2021/04/23/how-to-execute-a-javascript-function-on-all-forms-without-registering-it-manually/ 
    Hope this helps!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 414

#2
WarrenBelz Profile Picture

WarrenBelz 377 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 315 Super User 2026 Season 1

Last 30 days Overall leaderboard