I need to disable a field for users who don't have a certain security role via javascript.
So far I have got the user ID of the person:
// Get user ID var userID = Xrm.Page.context.getUserId(); alert (userID);
Searching for the answer on the forums I can see various examples such as:
// Set Global Variables serverUrl = context.getServerUrl(); userId = context.getUserId(); ODataPath = serverUrl + "/XRMServices/2011/OrganizationData.svc"; var retrieveReq = new XMLHttpRequest(); retrieveReq.open("GET", ODataPath + "/RoleSet?$select=Name&$filter=RoleId eq guid'" + roleId + "'", true); retrieveReq.setRequestHeader("Accept", "application/json"); retrieveReq.setRequestHeader("Content-Type", "application/json; charset=utf-8"); retrieveReq.onreadystatechange = function () { retrieveRoleNameReqCallBack(this); }; retrieveReq.send();
However this and the other examples fail - I am new to javascript so a little out of my depth at the moment.
regards,
Matt