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...
Suggested answer

Hide Edit option based on other field value in the form for Sub grid

(0) ShareShare
ReportReport
Posted on by 465

Hi All,

I am using sub grid in D365 Online

I want to disable "edit" option on sub grid based on the other field value in the form.

How can I achieve this.

Regards,

Babu

  • Narendra Sunkara Profile Picture
    Narendra Sunkara 465 on at
    RE: Hide Edit option based on other field value in the form for Sub grid

    Hi All,

    All good now

    I used full namespace and function name in Ribbon work bench and my javascript got triggered

    Regards,

    Babu

  • Narendra Sunkara Profile Picture
    Narendra Sunkara 465 on at
    RE: Hide Edit option based on other field value in the form for Sub grid

    Hi guys,

    After doing some further research, I came to know that I am using wrong entity(Sorry for confusion)

    Now I changed to correct Entity, but still my JavaScript function is not hitting and I can't hide the "Edit" button

    How to make a function public and how to call it from Ribbon workbench by using full namespace. If you can give me some examples it will be great

    Regards,

    Babu

  • Narendra Sunkara Profile Picture
    Narendra Sunkara 465 on at
    RE: Hide Edit option based on other field value in the form for Sub grid

    Thank you both for your replies,

    Here is what I can see when I click on "Edit" button in ribbon work bench

    Any other inputs please, I checked all the above points and looks fine, but still my debugger is not hitting 

    pastedimage1656906261648v1.png

    Regards,

    Babu

  • Ram Prakash Profile Picture
    Ram Prakash 2,287 on at
    RE: Hide Edit option based on other field value in the form for Sub grid

    Hi,

    1.Check the Command is attached in the Button.

    2.Put Debugger in the JavaScript and check the same weather the function is hitting or not

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,961 Moderator on at
    RE: Hide Edit option based on other field value in the form for Sub grid

    Hi,

    Can you please check if you have attached command to your button?

    I think you have created new command and added your js code but you will need to attach this command to your button.

  • Narendra Sunkara Profile Picture
    Narendra Sunkara 465 on at
    RE: Hide Edit option based on other field value in the form for Sub grid

    Hi

    Thanks for your reply.

    I tried to implement same thing and just added alert in JavaScript, unfortunately I can't see any alert message, I don't know what went wrong any advise what to check

    Regards,

    Babu

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Hide Edit option based on other field value in the form for Sub grid

    Hi Narendra Sunkara,

    You can create an Enable rule by Ribbon Workbench on your Edit button of related table in the subgrid. Please follow the steps:

    1.Load your solution which contains the related table by Ribbon Workbench.

    subgrid:

    pastedimage1656402601196v1.png

    pastedimage1656402636947v2.png

    2. Customise Edit button's command and create an enable rule whose type is custom rule:

    pastedimage1656402998094v6.png

    pastedimage1656402728433v3.png

    3. Create a JS type web resource whose code is like this:

    function getControl(primaryControl){
    	var formContext = primaryControl;
    	var title = formContext.getAttribute("title").getValue();
    	if(title && title == 'FW Support'){
                 return false;
             }else{
                   return true;
             }
    }
    

    4. Select the library in step3 and type the function name:

    pastedimage1656402877287v4.png

    5.Add the Enable rule to command and publish it:

    pastedimage1656402935151v5.png

    Result:

    pastedimage1656403036317v7.png

    Reference:

    xrmdynamicscrm.wordpress.com/.../

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