//PUT THIS CODE IN THE ONLOAD
if(UserHasRole("System Administrator"))
{
var oField1 = crmForm.all.long_taxscheduleid;
oField1.Disabled = !oField1.Disabled;
}
//THIS CODE CHECKS FOR A SPECIFIC SECURITY ROLE AND ALLOW FOR FORM EDITING
//alert(UserHasRole("System Administrator"));
function UserHasRole(roleName)
{
//get Current User Roles, oXml is an object
var oXml = GetCurrentUserRoles();
if(oXml != null)
{
//select the node text
var roles = oXml.selectNodes("//BusinessEntity/q1:name");
if(roles != null)
{
for( i = 0; i < text ="="" xml = "" version="\" encoding="\">" +
"
GenerateAuthenticationHeader() +
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
" " +
" " +
"
"
"";
var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("SOAPAction"," http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple");
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
xmlHttpRequest.send(xml);
var resultXml = xmlHttpRequest.responseXML;
return(resultXml);
}
No comments:
Post a Comment