function UserSecurityRoles() { UserID = Xrm.Page.context.getUserId(); UserID =UserID .replace("{","").replace("}",""); var fetchXml = "<fetch mapping='logical'>" + "<entity name='systemuser'>" + "<attribute name='systemuserid' />" + "<filter type='and'>" + "<condition attribute='systemuserid' operator='eq-userid' />" + "</filter>" + "<link-entity name='systemuserroles' from='systemuserid' to='systemuserid' visible='false' intersect='true'>" + "<link-entity name='role' from='roleid' to='roleid' alias='r'>" + "<filter type='or'>" + "<condition attribute='name' operator='eq' value='Accounts' />"; " </filter>" + "</link-entity>" + "</link-entity>" + "</entity>" + "</fetch>"; var users = ExecuteFetch(fetchXml); } function ExecuteFetch (originalFetch) { var users; var fetch = encodeURI(originalFetch); var serverURL = Xrm.Page.context.getClientUrl(); var Query = "?fetchXml=" + fetch; var req = new XMLHttpRequest(); req.open("GET", OdataQuery + Query, false); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Content-Type", "application/json; charset=utf-8"); req.onreadystatechange = function () { if (this.readyState == 4 /* complete */) { req.onreadystatechange = null; if (this.status == 200) { users = JSON.parse(this.responseText).d; } } else { var error = JSON.parse(this.response).error; } } }; req.send(); return users ;
I have tried numerous methods and have hit a brick wall.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)