Thursday, January 31, 2008

Hide Tab , Button base on Security Role in Javascript in CRM 4.0

Dear,

Here is some code for Javascript in CRM 4.0 I am using , it will help you and cover your queries as many of you looking CRM 4.0 Javascript help.

// Check Current User Security Roles and hide tab / field / Button base on that

Here is some code for Javascript in CRM 4.0 I am using , it will help you to hide/ disable Tab, Field, Section using Javascript in CRM 4.0

// pass string of role like Sales Person,/ Administrator and check if that is role exist
function CheckCurrentRole()
{

//

var userXml = GetUserRoles();
if(userXml != null)
{
//select the node text
var allRoles = userXml.selectNodes("//BusinessEntity/q1:name");
if(allRoles != null)
{
for(int i = 0; i < text ="="" visibility = "hidden" position = "absolute" text ="="" lisdocument =" document.getElementsByTagName('LI');
}
j= j + 1;
}

}
}}}
}

function GetUserRoles(){

// define XML for retrieve query, for more ask me if you have to buid any query regarding
var xmlQuery = "" + "" + "" + GenerateAuthenticationHeader() + " " + " " + " " + " role" + " " + " " + " name" + " " + " " + " false" + " " + " " + " roleid" + " role" + " systemuserroles" + " roleid" + " Inner" + " " + " " + " systemuserid" + " systemuserroles" + " systemuser" + " systemuserid" + " Inner" + " " + " And" + " " + " " + " systemuserid" + " EqualUserId" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + "" + "";
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);
// send xml query and get xml data from CRM in Javascript.
xmlHttpRequest.send(xmlquery);
var resultXml = xmlHttpRequest.responseXML;
// return xml for user role
return(resultXml);}





If you have to get current user info ( user id, organization id, etc)

// Get Current User Information in Javascript

function GetWhoAmI(){
var crmserver = http://crmserver/;

var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
xmlhttp.open("POST",crmserver + "/mscrmservices/2007/crmservice.asmx", false);
xmlhttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlhttp.setRequestHeader("SOAPAction", http://schemas.microsoft.com/crm/2007/WebServices/Execute);
var soapBody = ""+""+""+"";
var soapXml = "";s
oapXml += GenerateAuthenticationHeader();soapXml += soapBody;soapXml += "";
xmlhttp.send(soapXml);
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;

// Load XML and parse the nodes.
xmlDoc.loadXML(xmlhttp.responseXML.xml);
// Get Current User ID
var uid = xmlDoc.getElementsByTagName("UserId")[0].childNodes[0].nodeValue;
// Get Current Business Unit ID
var bid = xmlDoc.getElementsByTagName("BusinessUnitId")[0].childNodes[0].nodeValue;

// Get Current Organization ID Value
var oid = xmlDoc.getElementsByTagName("OrganizationId")[0].childNodes[0].nodeValue;

alert("Current User Id: " + uid + "\r\nBusiness Unit Id: " + bid + "\r\nOrganization Id: " + oid);
}



Contact me directly if you have any query ( mscrmexpert@gmail.com)


Regards,
Imran

Tuesday, January 29, 2008

MS CRM 4.0 - Common Upgrade Issues

Dear Readers,

I came to know many upgrade issues questions, here are little bit detail for you while upgrading.

Keep following things in your mind if you are upgrading from MS CRM 3.0 to CRM 4.0

  • Any Un supported customization will not upgrade
  • Any 3rd party tool will not upgrade like C360 components etc. It will give you trouble so first remove that and check your vendor for upgradeable version for CRM 4.0, I am sure they are upgrading it.
  • Any Connector like GP Connector, Biztalk Adapter will not upgrade
  • CRM Mobile Express 3.0 will not upgrade
  • CRM Accelerator for Seible will not supported to upgrade.
  • Sharepoint list webpart will not upgrade
  • Datamigration Pack will not upgrade
  • Your custom calls or code will not upgrade, you have to rebuild your code using new crm services, atleast you have to use crm discovery as it is multi-organizational system.
  • CRM Outlook Client will not upgrade
  • Any custom code for outlook will not upgrade
  • CRM Callouts need to modify and register with Plugin Register tool
  • Your code web to lead or web to contact need to modify by using CRM Discovery Service and updation manually
  • Any Code will not upgrade by MS CRM 4.0, you have to do manually all configuration
  • Assembly written for workflow will not upgrade and link, you have to again link with it

Standard CRM Reports will be upgraded and link will automatically build with new CRM SRS connection. but following types of reports will not upgrade

  • The Reports has been modified to use expressions for linking will not upgrade.
  • The Report has been modified to use stored procedures will not upgrade.

  • Reports that use information about workflow, such as sales pipeline report etc will not upgrade.

Dear Consultants / implementers please check above list, you have to care while upgrading as there are 90% questions so far about this on forums.

Hopefull it will help you alot to understand CRM Upgrade issues.

Regards,

Imran

Friday, January 25, 2008

TOP Answerer on the CRM Forums

Dear Readers,

I am now TOP1 answerers on the MS CRM Forums (CRM, Deployment & Development).

Check out this one plz

http://forums.microsoft.com/Dynamics/TopAnswerers.aspx?SiteID=27 - (Imran - mscrmexpert).

Thanks for your cooperation.

Regards,
Imran

msn : mscrmexpert@gmail.com

skype : mscrmexpert

Sunday, January 06, 2008