Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to Set the Sub grid read only using Ribbon Work Bench Latest Version in MS CRM 365

(0) ShareShare
ReportReport
Posted on by 95

How to Set the Sub grid read only using Ribbon Work Bench Latest Version in MS CRM 365

*This post is locked for comments

  • Suggested answer
    Nithya Gopinath Profile Picture
    Nithya Gopinath 17,076 on at
    RE: How to Set the Sub grid read only using Ribbon Work Bench Latest Version in MS CRM 365

    Hi,

    In order to disable the subgrid using javascript, use the code below.

    function DisableSubgrid() {
        // Get subgrid control
        var subGridCtrl = window.parent.document.getElementById("SubgridName_span");
    
        // If subgrid is not loaded yet, then call same function after some time.
        if (subGridCtrl == null) {
        setTimeout(DisableSubgrid, 1000)
        return;
        }
    
        // Disable the subgrid control
        subGridCtrl.disabled = true;
    }

    Hope this helps.

  • Suggested answer
    ashlega Profile Picture
    ashlega 34,477 on at
    RE: How to Set the Sub grid read only using Ribbon Work Bench Latest Version in MS CRM 365

    Hi Sars,

    - you need to register it on the entity which will be added to the subgrid (create/update)

    - in the plugin, you need to check the lookup field. If it's not there, you can just exit from the plugin

    - If the lookup is there (target.Contains(<lookup_attrib_name>), then you need to check whatever conditions you want to check. For example, you might retrieve the "parent" entity and see if it's "inactive":

      var parent = service.Retrieve(((EntityReference)target[<lookup_attrib_name>]).logicalName, ((EntityReference)target[<lookup_attrib_name>]).Id, new ColumnState("statecode"));

     if((int)parent["statecode"] != 0) //I believe state code is int, but could be an optionsetvalue

     {

        throw new InvalidPluginExecutionException("Parent entity is read-only");

     }

    That said, you can do the same with a real-time workflow (just create a workflow, register on the update/create of the child entity, verify parent conditions, and stop it as "cancelled" if needed - the user will see an error message similar to that you'll throw from the plugin)

  • sars Profile Picture
    sars 95 on at
    RE: How to Set the Sub grid read only using Ribbon Work Bench Latest Version in MS CRM 365

    Hi Alex,

    Can you please give me outline logic for to write the plugin code to control add the new rows in subgrid?

    Thanks

    Saravanan

  • Suggested answer
    ashlega Profile Picture
    ashlega 34,477 on at
    RE: How to Set the Sub grid read only using Ribbon Work Bench Latest Version in MS CRM 365

    Hi Sars,

     have a look at this article - it outlines all the options (plus there is a link to Ribbon Workbench.. never tried it for subgrids, though):

    crmbusiness.wordpress.com/.../crm-2013-disabling-a-subgrid

     Personally, I'd just go with a real-time workflow or plugin to display an error when a user attempts to add something to the "readonly" subgrid

  • sars Profile Picture
    sars 95 on at
    RE: How to Set the Sub grid read only using Ribbon Work Bench Latest Version in MS CRM 365

    Hi ,

    Thanks for ur reply.

    please let me know if any other way to set sub grid is read only.

    and also if possible to set sub grid disabled using java script code.

  • Suggested answer
    Nithya Gopinath Profile Picture
    Nithya Gopinath 17,076 on at
    RE: How to Set the Sub grid read only using Ribbon Work Bench Latest Version in MS CRM 365

    Hi,

    It is not possible to set the sub-grid read only using ribbon workbench.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans