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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

how to call javascript on ms crm home page onload ?

(0) ShareShare
ReportReport
Posted on by 20

i want to call javascript function on ms crm home page load .

like , i want to display a message , hide a button etc 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Irene Chng Profile Picture
    40 on at

    you can use this method to display the message.

    Xrm.Page.ui.setFormNotification(message, level, uniqueId);

    Parameter of Level defines how the message will be displayed.

    • WARNING : Notification will use the system warning icon.
    • INFO : Notification will use the system info icon.
    • ERROR : Notification will use the system error icon.

    What kind of button do you want to hide? Custom or OOB button?

  • Community Member Profile Picture
    on at

    What do you mean by home page? Starter page can be different for different users.

  • Suggested answer
    JayeshAC Profile Picture
    1,157 on at

    Hi Raju,

    A . Which kind of message you want to display onload of form?

    For error, information or warning message, you can use below code.

    1. Xrm.Page.ui.setFormNotification("This is an INFORMATION notification.", "INFORMATION") 

    2. Xrm.Page.ui.setFormNotification("This is a WARNING notification. ", "WARNING") 
    3. Xrm.Page.ui.setFormNotification("This is an ERROR notification. ", "EROR")
    B. what do you mean with HomePage? Is it Form or HomeGrid?
    For Form, you can use onload event of form to run your javascript
    For HomeGrid, you can write your javascript in button Enable/Display rule. it will show your message and hide the button according the conditions you have mentioned in that script.
    Regards,
    Jayesh
  • Raju Bathula Profile Picture
    20 on at

    ok, thanks for your reply

    my actual requirement is Display a notificationbar in sales activity dashboard onload

    can you suggest me for that ...

  • Raju Bathula Profile Picture
    20 on at

    thanks for your reply

    my actual requirement is Display a notificationbar in sales activity dashboard onload

    can you suggest me for that ...

  • Suggested answer
    BharatPremji Profile Picture
    2,485 on at

    Hi Raju,

    I have done something similar in the past to set up a re-direct from a dashboard.

    Create a new HTML webresource and put the following code into the Source tab:

    <html><head><meta charset="utf-8"></head>
    <body style="-ms-word-wrap: break-word;">
    <script type="text/javascript">
    function redir() {
    alert("This system is no longer active. You will now be redirected");
    window.top.location.href="https://google.com";
    }
    redir();
    </script>
    <br></body></html>

    You'll need to replace the redir() function with the alert you want.

    Then simply add the HTMl resource as a component on the dashboard

    Bharat

  • Community Member Profile Picture
    on at

    I have the same issue, can you share more details about how to use Enable/Display Rule ?

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Varsha deshpande Profile Picture

Varsha deshpande 5

#2
JS-09031509-0 Profile Picture

JS-09031509-0 3

#3
Ciprian  P Profile Picture

Ciprian P 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans