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