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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Answered

Deprecated Api - Replacement for Notification Banner script

(0) ShareShare
ReportReport
Posted on by 74 User Group Leader

Dynamics CRM 8 and earlier supported Api Xrm.Page which you could use in a script to set alert banners at the top of a page/form in the UI.

I want to update my custom scripts that use Xrm.Page.getAttribute andxrm.page.ui.setformnotification Xrm.Page.ui.setFormNotification since Xrm.Page has been deprecated in Dynamics 365 9.

I know I need to use formContext.ui.setFormNotification instead of xrm.page.ui.setformnotification. What do I use to replace Xrm.Page.getAttribute?
Thanks!

example script to be updated:

function CustSvcManaged() {

    var CustSvcManaged = Xrm.Page.getAttribute("et_custsvcmgd").getValue()

    if (CustSvcManaged == '1') {

        Xrm.Page.ui.setFormNotification("This customer is managed by the Customer Service group", "INFORMATION");
    }
}

I have the same question (0)
  • Verified answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi,

    You need to use formcontext. Refer below-

    docs.microsoft.com/.../clientapi-form-context

    Do remember to pass the context when you register the event in crm. Refer below for more details-

    carldesouza.com/.../

    Here is what it will looks like-

    =====================================

    function CustSvcManaged(executionContext) {

       var formContext = executionContext.getFormContext();

       var CustSvcManaged = formContext.getAttribute("et_custsvcmgd").getValue();

       if (CustSvcManaged == '1') {

           formContext.ui.setFormNotification("This customer is managed by the Customer Service group", "INFORMATION");

       }

    }

    ======================

    Hope this helps.

  • Allie_B Profile Picture
    74 User Group Leader on at

    Thanks so much, Ravi! That's what I was looking for! :)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 73 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 42 Most Valuable Professional

#3
Scott Jackson UK Profile Picture

Scott Jackson UK 22

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans