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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

UI D365CRM on-premise

(0) ShareShare
ReportReport
Posted on by 8

We are trying to move to UI from the legacy classic interface and i realise the javscripts those work perfectly on classic interface doesnt work when i switch to UI. 

What shall i do, how can i fix these scripts or write new ones that can work for UI interface.

Scripts that are not working are like hid/show tabs, sections.

Note: we are D365 On-premise 9.0

Thanks,

PS10

I have the same question (0)
  • Community Member Profile Picture
    on at

    Hi PS10,

    Could you provide the code which not work on the UI?

  • PS10 Profile Picture
    8 on at

    Hi Steve,

    Below is the script where i want to refresh form when a record is added into a subgrid or when it is deactivated, working fine in Classic interface but in UI it keeps on re-loading the subgrid data, like continuous blink, i wrote this after finding some script from internet so any correction to it will be helpful, i do not know how to write jscript my own, we are on-premise 9.0

    function Form_onLoad() {

       setTimeout("SubGridRefresh();", 2500);

    }

    function SubGridRefresh() {

       var grid = Xrm.Page.getControl("Characteristics");

       if (grid) {

           grid.addOnLoad(ReloadForm);

       }

    }

    function ReloadForm() {

       Xrm.Page.data.refresh(true);

    }

    Thanks,

    PS

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi PS10,

    I tested your code on my side and get the same error with yours.(I'm using D365 Online) This is due to the refresh() method would trigger grid.onload() function. Please try this code:

    var reload = true;
    function Form_onLoad() {

    setTimeout("SubGridRefresh();", 2500);

    }

    function SubGridRefresh() {
    var grid = Xrm.Page.getControl("Characteristics");
    if (grid) {
    grid.addOnLoad(ReloadForm);

    }
    }

    function ReloadForm() {
    if(!reload){
    return;
    }
    Xrm.Page.data.refresh(true).then(function success(){
    reload = false;
    setTimeout(function(){reload = true;console.log("Timeout:" + reload);}, 2500);
    }, function fail(error){
    console.log(error.message);
    });
    }

    By the way, Xrm.Page is deprecated(Although it can still work), you would better use formContext instead

    https://itsfascinating.com/d365/tag/xrm-page-context

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!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Nagaraju_Matta Profile Picture

Nagaraju_Matta 121

#2
ManoVerse Profile Picture

ManoVerse 67 Super User 2026 Season 1

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 66 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans