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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Hiding New/Save buttons based on a settings page field value

(0) ShareShare
ReportReport
Posted on by 40

Hi,

In the Sales CRM, I have a settings table with the fields with which I want to control the editing of the Tables like Product, Customer, Contact etc.

Eg.  If the field ProductEditingAllowed is set to true, I want to show the New, Save buttons for the Product.  If the value is set to No, I want to hide the buttons.

With the simple javascript function setting the return value to true or false, I managed to show or hide buttons but now I want the buttons to be controlled based on the settings table field values.

Can you please let me know whether this is possible or any other better way to achieve this?

Thanks and Regards.

I have the same question (0)
  • Suggested answer
    Torrado Profile Picture
    1,270 on at

    Hello,

    Yes, it's possible using Ribbon Workbench + Enable Rule (there you can create the custom visibility logic using JavaScript).

    Please refer to this official article about Enable Rules: docs.microsoft.com/.../define-ribbon-enable-rules

    Hope this helps you.

    Please mark the answer as verified if helpful. That will help others in future.

  • MSD_BC_User Profile Picture
    40 on at

    Hi Torrado,

    Thanks for directing to the appropriate article.  It has helped me to find the solution.  The below code works perfectly for my case.  When the field

    new_productgroupaddeditallowed is true the New / Delete/ Save ribbon buttons are visible if not they are hidden.

    function hide() {
        var fetchXML = `
    			  
    				
    				
    			  
    			`;
    
        console.log("[GetDefaultDataSettings] fetchXML: "   fetchXML);
        const request = new XMLHttpRequest();
        request.open('GET', Xrm.Page.context.getClientUrl()  
            "/api/data/v9.0/new_rsc_data_settings?fetchXml="   encodeURIComponent(fetchXML));
    
        return new Promise(function (resolve, reject) {
            request.onload = function (e) {
                if (request.readyState === 4) {
                    if (request.status === 200) {
    
                        var responseValue = JSON.parse(request.responseText);
                        console.log("data new_productgroupaddeditallowed value "   responseValue.value[0]["new_productgroupaddeditallowed"]);
    
                        var flag = responseValue.value[0]["new_productgroupaddeditallowed"];
    
                        resolve(request.responseText = flag);
                    }
                    else {
                        reject(request.statusText);
                    }
                }
            };
            request.onerror = function (e) {
                reject(request.statusText);
            };
    
            request.send(null);
        });
    }

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 180 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 123

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans