Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

Hide Ribbon Button based on currents users record value.

$
0
0

Hi

There is this scenario where I need to hide some Ribbon Buttons only if there is a particular option set field value on System user record. I wrote the below JavaScript and calling the function using an enable rule. But it won't work. 

function hideButtonsForm() {

        var cUser = Xrm.Page.context.getUserId();

        if (cUser[0] != null && cUser[0].entityType == "systemuser") {

            SDK.REST.retrieveRecord(
               cUser[0].id,
                "SystemUser",
                null, null,
                function (userData) {

                    if (userData.new_Division.Value == 534340002) {

                        return false;
                    }
                    else {
                        return true;
                    }
                },
                errorHandler
              );
        }
    }

function errorHandler(error) {

}

Is there an alternative method to achieve this? Thanks in advance 


Viewing all articles
Browse latest Browse all 79901

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>