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

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

making a subgrid readonly on condition

(0) ShareShare
ReportReport
Posted on by 2

I have a table /X/ in CRM with a form that contains a subgrid from related table /Y/.

I would like to make it so that when a condition is met on a record of table /X/ like status = signed, then the subgrid should be locked, ie it should not be possible to add a new relation using the subgrid and it should not be possible to click a record in the subgrid and edit it either by making the record not clickable or having the form on record Y have only readonly fields.

is this possible

I have the same question (1)
  • Suggested answer
    Dengliang Li Profile Picture
    Microsoft Employee on at
    making a subgrid readonly on condition
    Hi,
     
    This can be implemented with the following code.

    function onload(executionContext){
        var formContext = executionContext.getFormContext();
     
        //get the Disable Subgrid field value
        var disable_subgrid = formContext.getAttribute("cr147_disablesubgrid").getValue();
        // get the Case Subgird HTML element
        var case_subgrid = parent.parent.window.document.querySelector("div[data-control-name='contactcasessgrid']");
        //Check if the Case Subgrid HTML element is loaded
        if(case_subgrid !== null){
           
            //If the Disable Subgrid field is set to Yes, disable the Case Subgrid.
            if(disable_subgrid === true){
                //set the Case Subgrid not clickable.
                case_subgrid.style.pointerEvents = "none";
                return;
            }
        }else{
            // Wait for some time to check again if the page elements are loaded.
            setTimeout(onload,10,executionContext);
        }
         
    }

     
    I have created a /Disable Subgrid/ field on the form that disables /Case Subgrid/ each time the page loads when the value of this field is set to Yes.
     
     
    If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more.

    If you have further questions, please feel free to contact me .
     
    Best Regards,
    Dengliang Li
                                                                                                                                                                                           
     
                                                                                                                                                                                                                                                                                                                                              
     
     
     
  • SH-15050646-0 Profile Picture
    2 on at
    making a subgrid readonly on condition
    Thanks for the suggestion, I thought you solution would work, and it did make the subgrid not clickable but I still need to be able to scroll, change pages and filter on the subgrid and i cant do that with your solution unfortunately.
    Do you have any other suggestions? 

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 117 Super User 2025 Season 2

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 110

#3
#ManoVerse Profile Picture

#ManoVerse 56

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans