There are times when we need to assign roles promatically may plugin or else threu any applications suing the sdk.
here is the code to assign the role.
make sure u have the suer GUID and the roles GUIDs u wan to assign.
and keep it in mind that the higher role previlege will apply for that user.
private static void assignRole(Guid userGUID, Guid[] rolesGUID)
{
// Set up the CRM service.
CrmAuthenticationToken token = new CrmAuthenticationToken();
// You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0;
token.OrganizationName = "Default";
CrmService service = new CrmService();
service.Url = "http://<server>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
// Create the request object.
AssignUserRolesRoleRequest assign = new AssignUserRolesRoleRequest();
// Set the properties of the request object.
assign.UserId = userGUID;
// Set the ID of a role that is in the same business unit as the user.
assign.RoleIds = rolesGUID;
// Execute the request.
AssignUserRolesRoleResponse assigned = (AssignUserRolesRoleResponse)service.Execute(assign);
}
Sudhanshu
Thursday, December 30, 2010
Tuesday, December 21, 2010
Use Custom View in the in form MS CRM 4.0
There is some times a requirement like people want to use custom views in MS CRM form instead of the available views also with some filtering criterias.
This is how it will work.
The followings are the things need to be taken care
1. collect the entity details
2. create an IFRAME
3. make sure the columns you want to put are present in CRM and searchable(imp)
4. this is just a sample, change it as per your requirements
5. this is just showing the record which you have selected, by taking the guid
so check the code,against most of the lines we have comments which will make it easy
//the main function which will do the majic
function EmbedAdvancedFindView (iFrameId, entityName, fetchXml, layoutXml, sortCol, sortDescend, defaultAdvFindViewId, entityTypeId) {
// Initialize our important variables
var httpObj = new ActiveXObject("Msxml2.XMLHTTP");
var url = SERVER_URL + "/AdvancedFind/fetchData.aspx";
var iFrame = document.getElementById(iFrameId);
var win = iFrame.contentWindow;
var doc = iFrame.contentWindow.document;
// Provide a global function within the parent scope to avoid XSS limitations
// in updating the iFrame with the results from our HTTP request
PushResponseContents = function (iFrame, httpObj, entityTypeId) {
var win = iFrame.contentWindow;
var doc = iFrame.contentWindow.document;
var m_iFrameShowModalDialogFunc = null;
var m_windowAutoFunc = null;
// Write the contents of the response to the Iframe
doc.open();
doc.write(httpObj.responseText);
doc.close();
// Set some style elements of the Advanced Find window
// to mesh cleanly with the parent record's form
doc.body.style.padding = "0px";
doc.body.scroll="no";
// Should we overwrite the functionality of the "New" button?
if ((typeof(entityTypeId) != "undefined") && (entityTypeId != null)) {
var buttonId = "_MBopenObj" + entityTypeId;
var newButton = doc.getElementById(buttonId);
eval("newButton.action = 'locAddRelatedToNonForm(" + entityTypeId + ", " + crmForm.ObjectTypeCode + ", \"" + crmForm.ObjectId + "\",\"\");'");
}
// Swap the showModalDialog function of the iFrame
if (m_iFrameShowModalDialogFunc == null) {
m_iFrameShowModalDialogFunc = win.showModalDialog;
win.showModalDialog = OnIframeShowModalDialog;
}
if (m_windowAutoFunc == null) {
m_windowAutoFunc = win.auto;
win.auto = OnWindowAuto;
}
// Configure the automatic refresh functionality for dialogs
function OnIframeShowModalDialog(sUrl, vArguments, sFeatures) {
m_iFrameShowModalDialogFunc(sUrl, vArguments, sFeatures);
doc.all.crmGrid.Refresh();
}
function OnWindowAuto(otc) {
doc.all.crmGrid.Refresh();
m_windowAutoFunc(otc);
}
}
// Without a null src, switching tabs in the form reloads the src
iFrame.src = null;
// Preload the iFrame with some HTML that presents a Loading image
var loadingHtml = ""
+ "<table height='100%' width='100%' style='cursor:wait'>"
+ " <tr>"
+ " <td valign='middle' align='center'>"
+ " <img alt='' src='/_imgs/AdvFind/progress.gif' />"
+ " <div /><i>Loading View...</i>"
+ " </td>"
+ " </tr>"
+ "</table>";
doc.open();
doc.write(loadingHtml);
doc.close();
// Compile the FetchXML, LayoutXML, sortCol, sortDescend, defaultAdvFindViewId, and viewId into
// a list of params to be submitted to the Advanced Find form
var params = "FetchXML=" + fetchXml
+ "&LayoutXML=" + layoutXml
+ "&EntityName=" + entityName
+ "&DefaultAdvFindViewId=" + defaultAdvFindViewId
+ "&ViewType=1039" // According to Michael Hohne over at Stunnware, this is static
+ "&SortCol=" + sortCol
+ "&SortDescend=" + sortDescend;
// Establish an async connection to the Advanced Find form
httpObj.open("POST", url, true);
// Send the proper header information along with the request
httpObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
httpObj.setRequestHeader("Content-length", params.length);
// Function to write the contents of the http response into the iFrame
httpObj.onreadystatechange = function () {
if (httpObj.readyState == 4 && httpObj.status == 200) {
parent.PushResponseContents(iFrame, httpObj, entityTypeId);
}
}
//alert(params);
// Set it, and forget it! and enjoy :)
httpObj.send(params);
}
///*********************************************
//Create the objects
//get the current record's GUID
var IFRAME_Name = "IFRAME_Accounts";
var entityName = "new_residencestatus";
var currentGUID = crmForm.ObjectId.toString();
// Embed an AF window
fetchXml = ""
+ "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>"
+ " <entity name='new_residencestatus'>" //the enityname for whoch u want to create the view
+ " <attribute name='new_residencestatusid'/>" //columns u want to fetch
+ " <attribute name='new_name'/>" //same as above
+ " <order attribute='new_name' descending='false'/>" //for which column u want to order
+ " <filter type='and'>"
+ " <condition attribute='new_residencestatusid' operator='eq' value='" //pass your conditional value
+ currentGUID
+"'/>"
+ " </filter>"
+ " </entity>"
+ "</fetch>";
layoutXml = ""
+ "<grid name='resultset'>"
+ " <row name='result' id='new_residencestatusid'>" //be careful for this is , it should be same as the primarykey
+ " <cell name='new_name' width='150' />" //columns you want to show and fetched in the column list
+ " </row>"
+ "</grid>";
var sortColumnName = "new_name";
var sortDescend = "false";
var associatedViewGUID = "{93A408E0-A6E5-4149-9510-4EF333C0FC43}";
var objectTypeCode = crmForm.ObjectTypeCode.toString();
//call the master and majic method :)
EmbedAdvancedFindView(IFRAME_Name, entityName, fetchXml, layoutXml, sortColumnName, sortDescend, associatedViewGUID, objectTypeCode);
//hide the unnecessary menu bar from the grid
function hideViewMenu(){
var formview = document.all.IFRAME_Accounts;
if( formview.readyState != 'complete' )
return;
formview.contentWindow.document.getElementById("gridMenuBar").style.display = "none";
formview.contentWindow.document.getElementById("mnuBar1").parentNode.style.display = "none";
}
//hide the menubar from the view
var Form = crmForm.all.IFRAME_Accounts;
Form.attachEvent("onreadystatechange",hideViewMenu);
Sudhanshu
This is how it will work.
The followings are the things need to be taken care
1. collect the entity details
2. create an IFRAME
3. make sure the columns you want to put are present in CRM and searchable(imp)
4. this is just a sample, change it as per your requirements
5. this is just showing the record which you have selected, by taking the guid
so check the code,against most of the lines we have comments which will make it easy
//the main function which will do the majic
function EmbedAdvancedFindView (iFrameId, entityName, fetchXml, layoutXml, sortCol, sortDescend, defaultAdvFindViewId, entityTypeId) {
// Initialize our important variables
var httpObj = new ActiveXObject("Msxml2.XMLHTTP");
var url = SERVER_URL + "/AdvancedFind/fetchData.aspx";
var iFrame = document.getElementById(iFrameId);
var win = iFrame.contentWindow;
var doc = iFrame.contentWindow.document;
// Provide a global function within the parent scope to avoid XSS limitations
// in updating the iFrame with the results from our HTTP request
PushResponseContents = function (iFrame, httpObj, entityTypeId) {
var win = iFrame.contentWindow;
var doc = iFrame.contentWindow.document;
var m_iFrameShowModalDialogFunc = null;
var m_windowAutoFunc = null;
// Write the contents of the response to the Iframe
doc.open();
doc.write(httpObj.responseText);
doc.close();
// Set some style elements of the Advanced Find window
// to mesh cleanly with the parent record's form
doc.body.style.padding = "0px";
doc.body.scroll="no";
// Should we overwrite the functionality of the "New" button?
if ((typeof(entityTypeId) != "undefined") && (entityTypeId != null)) {
var buttonId = "_MBopenObj" + entityTypeId;
var newButton = doc.getElementById(buttonId);
eval("newButton.action = 'locAddRelatedToNonForm(" + entityTypeId + ", " + crmForm.ObjectTypeCode + ", \"" + crmForm.ObjectId + "\",\"\");'");
}
// Swap the showModalDialog function of the iFrame
if (m_iFrameShowModalDialogFunc == null) {
m_iFrameShowModalDialogFunc = win.showModalDialog;
win.showModalDialog = OnIframeShowModalDialog;
}
if (m_windowAutoFunc == null) {
m_windowAutoFunc = win.auto;
win.auto = OnWindowAuto;
}
// Configure the automatic refresh functionality for dialogs
function OnIframeShowModalDialog(sUrl, vArguments, sFeatures) {
m_iFrameShowModalDialogFunc(sUrl, vArguments, sFeatures);
doc.all.crmGrid.Refresh();
}
function OnWindowAuto(otc) {
doc.all.crmGrid.Refresh();
m_windowAutoFunc(otc);
}
}
// Without a null src, switching tabs in the form reloads the src
iFrame.src = null;
// Preload the iFrame with some HTML that presents a Loading image
var loadingHtml = ""
+ "<table height='100%' width='100%' style='cursor:wait'>"
+ " <tr>"
+ " <td valign='middle' align='center'>"
+ " <img alt='' src='/_imgs/AdvFind/progress.gif' />"
+ " <div /><i>Loading View...</i>"
+ " </td>"
+ " </tr>"
+ "</table>";
doc.open();
doc.write(loadingHtml);
doc.close();
// Compile the FetchXML, LayoutXML, sortCol, sortDescend, defaultAdvFindViewId, and viewId into
// a list of params to be submitted to the Advanced Find form
var params = "FetchXML=" + fetchXml
+ "&LayoutXML=" + layoutXml
+ "&EntityName=" + entityName
+ "&DefaultAdvFindViewId=" + defaultAdvFindViewId
+ "&ViewType=1039" // According to Michael Hohne over at Stunnware, this is static
+ "&SortCol=" + sortCol
+ "&SortDescend=" + sortDescend;
// Establish an async connection to the Advanced Find form
httpObj.open("POST", url, true);
// Send the proper header information along with the request
httpObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
httpObj.setRequestHeader("Content-length", params.length);
// Function to write the contents of the http response into the iFrame
httpObj.onreadystatechange = function () {
if (httpObj.readyState == 4 && httpObj.status == 200) {
parent.PushResponseContents(iFrame, httpObj, entityTypeId);
}
}
//alert(params);
// Set it, and forget it! and enjoy :)
httpObj.send(params);
}
///*********************************************
//Create the objects
//get the current record's GUID
var IFRAME_Name = "IFRAME_Accounts";
var entityName = "new_residencestatus";
var currentGUID = crmForm.ObjectId.toString();
// Embed an AF window
fetchXml = ""
+ "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>"
+ " <entity name='new_residencestatus'>" //the enityname for whoch u want to create the view
+ " <attribute name='new_residencestatusid'/>" //columns u want to fetch
+ " <attribute name='new_name'/>" //same as above
+ " <order attribute='new_name' descending='false'/>" //for which column u want to order
+ " <filter type='and'>"
+ " <condition attribute='new_residencestatusid' operator='eq' value='" //pass your conditional value
+ currentGUID
+"'/>"
+ " </filter>"
+ " </entity>"
+ "</fetch>";
layoutXml = ""
+ "<grid name='resultset'>"
+ " <row name='result' id='new_residencestatusid'>" //be careful for this is , it should be same as the primarykey
+ " <cell name='new_name' width='150' />" //columns you want to show and fetched in the column list
+ " </row>"
+ "</grid>";
var sortColumnName = "new_name";
var sortDescend = "false";
var associatedViewGUID = "{93A408E0-A6E5-4149-9510-4EF333C0FC43}";
var objectTypeCode = crmForm.ObjectTypeCode.toString();
//call the master and majic method :)
EmbedAdvancedFindView(IFRAME_Name, entityName, fetchXml, layoutXml, sortColumnName, sortDescend, associatedViewGUID, objectTypeCode);
//hide the unnecessary menu bar from the grid
function hideViewMenu(){
var formview = document.all.IFRAME_Accounts;
if( formview.readyState != 'complete' )
return;
formview.contentWindow.document.getElementById("gridMenuBar").style.display = "none";
formview.contentWindow.document.getElementById("mnuBar1").parentNode.style.display = "none";
}
//hide the menubar from the view
var Form = crmForm.all.IFRAME_Accounts;
Form.attachEvent("onreadystatechange",hideViewMenu);
Sudhanshu
Monday, December 20, 2010
DateTime to CrmDateTime conversion
We all know that DateTime in C# is different than CrmDateTime.
In CrmDateTime we also have two things 1. UserTime and 2. UniversalTime.
To convert from normal DateTime to CrmDateTime follow the follwoing code.
public static CrmDateTime ConvertToCRMDateTime(DateTime dateTime)
{
CrmDateTime crmDateTime = new CrmDateTime();
crmDateTime.date = dateTime.ToShortDateString(); //assign the date
crmDateTime.time = dateTime.ToShortTimeString();//assign the time
//now create the offset from the timezone
TimeSpan offset = TimeZone.CurrentTimeZone.GetUtcOffset(dateTime);
string sOffset = string.Empty;
if (offset.Hours < 0)
{
sOffset = "-" + (offset.Hours * -1).ToString().PadLeft(2, '0') + ":";
}
else
{
sOffset = "+" + offset.Hours.ToString().PadLeft(2, '0') + ":";//":" is more inmportant
}
sOffset += offset.Minutes.ToString().PadLeft(2, '0');
crmDateTime.Value = dateTime.ToString(string.Format("yyyy/MM/ddTHH:mm:ss{0}", sOffset));
return crmDateTime; //finally return the CrmDateTime format
}
In CrmDateTime we also have two things 1. UserTime and 2. UniversalTime.
To convert from normal DateTime to CrmDateTime follow the follwoing code.
public static CrmDateTime ConvertToCRMDateTime(DateTime dateTime)
{
CrmDateTime crmDateTime = new CrmDateTime();
crmDateTime.date = dateTime.ToShortDateString(); //assign the date
crmDateTime.time = dateTime.ToShortTimeString();//assign the time
//now create the offset from the timezone
TimeSpan offset = TimeZone.CurrentTimeZone.GetUtcOffset(dateTime);
string sOffset = string.Empty;
if (offset.Hours < 0)
{
sOffset = "-" + (offset.Hours * -1).ToString().PadLeft(2, '0') + ":";
}
else
{
sOffset = "+" + offset.Hours.ToString().PadLeft(2, '0') + ":";//":" is more inmportant
}
sOffset += offset.Minutes.ToString().PadLeft(2, '0');
crmDateTime.Value = dateTime.ToString(string.Format("yyyy/MM/ddTHH:mm:ss{0}", sOffset));
return crmDateTime; //finally return the CrmDateTime format
}
Sunday, December 19, 2010
Create a header with the form information in ms crm
Some times we need to show a header informations in ms crm 4.0.(but its available OTB in 5.0). as in pic.
just follw the followings and change ur attributes as per your requirements.
var elem = document.getElementById("leftNavBreadcrumbText");
var fullName = (crmForm.all.name.DataValue != null) ? crmForm.all.name.DataValue : "";
var NRIC = (crmForm.all.new_nric.DataValue != null) ? crmForm.all.new_nric.DataValue : "";
var handPhone= (crmForm.all.new_handphone.DataValue != null) ? crmForm.all.new_handphone.DataValue : "";
if (elem != null) {
var actualHTML = elem.innerHTML;
actualHTML += '
';
elem.innerHTML = actualHTML ;
}
Sudhanshu
just follw the followings and change ur attributes as per your requirements.
var elem = document.getElementById("leftNavBreadcrumbText");
var fullName = (crmForm.all.name.DataValue != null) ? crmForm.all.name.DataValue : "";
var NRIC = (crmForm.all.new_nric.DataValue != null) ? crmForm.all.new_nric.DataValue : "";
var handPhone= (crmForm.all.new_handphone.DataValue != null) ? crmForm.all.new_handphone.DataValue : "";
if (elem != null) {
var actualHTML = elem.innerHTML;
actualHTML += '
| actualHTML |
elem.innerHTML = actualHTML ;
}
Sudhanshu
Put a View in a form and on select of that record load the same to the Form in another Iframe
Its very frequent requirement.
like i want to put a view to the forma and on select(double click) it should load also to the same form(another iframe).
So just follow the following steps.
make sure the IFRAME names. change as per yours.
//*********************************************************************************
//put the two iframes and load the record on double cick of the record from one Iframe
//*********************************************************************************
//get the server url with port (if anything else 80) u can not really rely ;)
function getServerUrlWithPort()
{
return window.location.protocol + "//" + window.location.host ;
}
//this is for the
function OnGridViewReady()
{
var gridview = document.all.IFRAME_Grid;
if( gridview.readyState != 'complete' )
return;
gridview.contentWindow.document.getElementById('crmGrid_JumpBar').parentNode.parentNode.style.display = 'none';
gridview.contentWindow.document.getElementById("quickFindContainer").parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.style.display = "none";
gridview.contentWindow.document.getElementById("crmMenuBar").parentNode.parentNode.style.display = 'none';
var gridviewDocument = gridview.document.frames["IFRAME_Grid"].document;
var gridviewWindow = gridviewDocument.parentWindow;
gridviewWindow.open = OnWindowOpen;
gridviewDocument.body.scroll = "no";
}
//this will bind the url to the 2nd IFrame instead of opening it as new window
function OnWindowOpen( url )
{
var formview = document.all.IFRAME_Form;
//alert("aaaa"+url+"#######"+formview );
formview.src = getServerUrlWithPort() + url;
if (url != "/" + this.parent.ORG_UNIQUE_NAME + "/sfa/accts/edit.aspx")
return false;
}
//this will be fired when the form will be loaded to the 2nd IFrame
//hide the left nav area and other menu items also
function OnFormViewReady()
{
var formview = document.all.IFRAME_Form;
if( formview.readyState != 'complete' )
return;
formview.document.frames['IFRAME_Form'].document.body.style.border = "1px solid #6893cf";
if (formview.contentWindow.document.getElementById('leftNavBreadcrumbImg') == null)
return;
formview.contentWindow.document.getElementById('leftNavBreadcrumbImg').parentNode.parentNode.parentNode.parentNode.parentNode.style.display = 'none';
formview.contentWindow.document.getElementById('leftNavBreadcrumbImg').parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.height = '45';
formview.contentWindow.document.getElementById('crmMenuBar').parentNode.parentNode.style.display = 'none';
formview.contentWindow.document.getElementById('crmNavBar').parentNode.style.display = 'none';
formview.contentWindow.document.getElementById('tdAreas').colSpan = 2;
formview.contentWindow.document.getElementById('crmRenderStatus').parentNode.parentNode.style.display = 'none';
formview.contentWindow.document.getElementById('help').parentNode.parentNode.parentNode.parentNode.parentNode.style.display = 'none';
}
var Grid = crmForm.all.IFRAME_Grid;
var Form = crmForm.all.IFRAME_Form;
Grid.attachEvent("onreadystatechange",OnGridViewReady);
Form.attachEvent("onreadystatechange",OnFormViewReady);
//hide tab
crmForm.all.tab1Tab.style.display="none";
document.getElementById('help').style.display = "none";
document.getElementById('mnuDown').style.display = "none";
if(document.getElementById('navAsyncOperations') !=null)
{
document.getElementById('navAsyncOperations').style.display="none";
}
Sudhanshu
like i want to put a view to the forma and on select(double click) it should load also to the same form(another iframe).
So just follow the following steps.
make sure the IFRAME names. change as per yours.
//*********************************************************************************
//put the two iframes and load the record on double cick of the record from one Iframe
//*********************************************************************************
//get the server url with port (if anything else 80) u can not really rely ;)
function getServerUrlWithPort()
{
return window.location.protocol + "//" + window.location.host ;
}
//this is for the
function OnGridViewReady()
{
var gridview = document.all.IFRAME_Grid;
if( gridview.readyState != 'complete' )
return;
gridview.contentWindow.document.getElementById('crmGrid_JumpBar').parentNode.parentNode.style.display = 'none';
gridview.contentWindow.document.getElementById("quickFindContainer").parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.style.display = "none";
gridview.contentWindow.document.getElementById("crmMenuBar").parentNode.parentNode.style.display = 'none';
var gridviewDocument = gridview.document.frames["IFRAME_Grid"].document;
var gridviewWindow = gridviewDocument.parentWindow;
gridviewWindow.open = OnWindowOpen;
gridviewDocument.body.scroll = "no";
}
//this will bind the url to the 2nd IFrame instead of opening it as new window
function OnWindowOpen( url )
{
var formview = document.all.IFRAME_Form;
//alert("aaaa"+url+"#######"+formview );
formview.src = getServerUrlWithPort() + url;
if (url != "/" + this.parent.ORG_UNIQUE_NAME + "/sfa/accts/edit.aspx")
return false;
}
//this will be fired when the form will be loaded to the 2nd IFrame
//hide the left nav area and other menu items also
function OnFormViewReady()
{
var formview = document.all.IFRAME_Form;
if( formview.readyState != 'complete' )
return;
formview.document.frames['IFRAME_Form'].document.body.style.border = "1px solid #6893cf";
if (formview.contentWindow.document.getElementById('leftNavBreadcrumbImg') == null)
return;
formview.contentWindow.document.getElementById('leftNavBreadcrumbImg').parentNode.parentNode.parentNode.parentNode.parentNode.style.display = 'none';
formview.contentWindow.document.getElementById('leftNavBreadcrumbImg').parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.height = '45';
formview.contentWindow.document.getElementById('crmMenuBar').parentNode.parentNode.style.display = 'none';
formview.contentWindow.document.getElementById('crmNavBar').parentNode.style.display = 'none';
formview.contentWindow.document.getElementById('tdAreas').colSpan = 2;
formview.contentWindow.document.getElementById('crmRenderStatus').parentNode.parentNode.style.display = 'none';
formview.contentWindow.document.getElementById('help').parentNode.parentNode.parentNode.parentNode.parentNode.style.display = 'none';
}
var Grid = crmForm.all.IFRAME_Grid;
var Form = crmForm.all.IFRAME_Form;
Grid.attachEvent("onreadystatechange",OnGridViewReady);
Form.attachEvent("onreadystatechange",OnFormViewReady);
//hide tab
crmForm.all.tab1Tab.style.display="none";
document.getElementById('help').style.display = "none";
document.getElementById('mnuDown').style.display = "none";
if(document.getElementById('navAsyncOperations') !=null)
{
document.getElementById('navAsyncOperations').style.display="none";
}
Sudhanshu
Monday, November 29, 2010
Meta Data List can be seen as follows in ms crm 4.0
http://ServerName/Port/Organization/sdk/list.aspx
Tuesday, November 2, 2010
Guide to Dynamics CRM 4.0 Editions and Licensing
The purpose of this guide is to help you find the Dynamics CRM server and licenses appropriate to your organization's needs.
Microsoft Dynamics CRM 4.0 is available in three editions, each appropriate for different sizes and types of organizations. Additionally, several different licensing configurations are available, depending on the number and kind of users who will access the CRM database, as well as the type of access necessary.
Server Editions
Three separate versions of the Dynamics CRM 4.0 server are available through TechSoup Stock: Workgroup Server, Professional Server, and Enterprise Server.
Dynamics CRM 4.0 Workgroup Server: Dynamics CRM 4.0 Workgroup Server offers the same features as Professional Server, but does not operate under the Server/CAL licensing model. CRM 4.0 Workgroup Server includes licenses for a maximum of five users to access the server from any number of computers or other devices. There are no licenses available for additional users, devices, or external users.
Dynamics CRM 4.0 Professional Server: Dynamics CRM 4.0 Professional Server operates under a Server/CAL licensing model, similar to many other Microsoft server products. Client access licenses may be acquired on a per-user or per-device model, depending on the needs of the organization. See Client Access Licenses below.
Dynamics CRM 4.0 Enterprise Server: Dynamics CRM 4.0 Enterprise Server offers the same features and licensing model as Dynamics CRM 4.0 Professional Server, with the additional benefit of a multi-tenant architecture. In other words, the Enterprise Server allows organizations to maintain multiple, distinct CRM databases on one server with only one server license.
Client Access Licenses
Dynamics CRM 4.0 Professional and Enterprise require a client access license (CAL) for each user or device accessing the server. There are three different types of CALs available on either a per-user or per-device model.
Limited CAL: The limited CAL allows a user or device read-only access to the CRM server. In other words, users with a limited CAL may access CRM information but may not make any edits or updates to it.
Full Use Additive CAL: When used in conjunction with a limited CAL, a full use additive CAL allows a user or device write access to the CRM server, thus allowing the user or device full read-write access to the server. The full use additive CAL may be used only in conjunction with a limited CAL.
CAL: The CAL provides a user or device full read-write access to the CRM server. The CAL is functionally equivalent to a combined limited and full use additive CAL.
As with many other Microsoft server technologies, the CALs listed above are each available on a per-user or per-device basis. A user CAL authorizes one user to access the CRM server from any computer or other device (for example, when an employee accesses the server from a computer at work and another at home). A device CAL authorizes one computer or other device to access the CRM server, regardless of the number of users (for example, on a shared workstation).
External Connector Licenses
An external connector (EC) license allows any number of external users to access a single installation of Dynamics CRM 4.0 Professional or Enterprise. External users may not use the Dynamics CRM applications directly.
Generally, an external user is defined as anyone who is not an employee of the organization. For example, external users can include clients, suppliers, and alumni of the organization. External users do not include independent contractors, agents, service providers, or other persons providing services to or on behalf of the organization holding the license. As an alternative to an EC license, some organizations may choose to license each external user with a separate CAL or CALs.
EC licenses may not be used as a means of reselling or repackaging Dynamics CRM as a hosted service.
Limited External Connector: The limited EC license allows external users read-only access to the CRM server. In other words, external users may access CRM information but may not make any edits or updates to it.
Full Use Additive External Connector: When used in conjunction with a limited EC license, a full use additive EC license allows external users write access to the CRM server, thus allowing full read-write access to the server. The full use additive EC license may be used only in conjunction with a limited EC license.
External Connector: The EC license provides external users full read-write access to the CRM server. The EC license is functionally equivalent to a combined limited and full use additive EC license.
Microsoft Dynamics CRM 4.0 is available in three editions, each appropriate for different sizes and types of organizations. Additionally, several different licensing configurations are available, depending on the number and kind of users who will access the CRM database, as well as the type of access necessary.
Server Editions
Three separate versions of the Dynamics CRM 4.0 server are available through TechSoup Stock: Workgroup Server, Professional Server, and Enterprise Server.
Dynamics CRM 4.0 Workgroup Server: Dynamics CRM 4.0 Workgroup Server offers the same features as Professional Server, but does not operate under the Server/CAL licensing model. CRM 4.0 Workgroup Server includes licenses for a maximum of five users to access the server from any number of computers or other devices. There are no licenses available for additional users, devices, or external users.
Dynamics CRM 4.0 Professional Server: Dynamics CRM 4.0 Professional Server operates under a Server/CAL licensing model, similar to many other Microsoft server products. Client access licenses may be acquired on a per-user or per-device model, depending on the needs of the organization. See Client Access Licenses below.
Dynamics CRM 4.0 Enterprise Server: Dynamics CRM 4.0 Enterprise Server offers the same features and licensing model as Dynamics CRM 4.0 Professional Server, with the additional benefit of a multi-tenant architecture. In other words, the Enterprise Server allows organizations to maintain multiple, distinct CRM databases on one server with only one server license.
Client Access Licenses
Dynamics CRM 4.0 Professional and Enterprise require a client access license (CAL) for each user or device accessing the server. There are three different types of CALs available on either a per-user or per-device model.
Limited CAL: The limited CAL allows a user or device read-only access to the CRM server. In other words, users with a limited CAL may access CRM information but may not make any edits or updates to it.
Full Use Additive CAL: When used in conjunction with a limited CAL, a full use additive CAL allows a user or device write access to the CRM server, thus allowing the user or device full read-write access to the server. The full use additive CAL may be used only in conjunction with a limited CAL.
CAL: The CAL provides a user or device full read-write access to the CRM server. The CAL is functionally equivalent to a combined limited and full use additive CAL.
As with many other Microsoft server technologies, the CALs listed above are each available on a per-user or per-device basis. A user CAL authorizes one user to access the CRM server from any computer or other device (for example, when an employee accesses the server from a computer at work and another at home). A device CAL authorizes one computer or other device to access the CRM server, regardless of the number of users (for example, on a shared workstation).
External Connector Licenses
An external connector (EC) license allows any number of external users to access a single installation of Dynamics CRM 4.0 Professional or Enterprise. External users may not use the Dynamics CRM applications directly.
Generally, an external user is defined as anyone who is not an employee of the organization. For example, external users can include clients, suppliers, and alumni of the organization. External users do not include independent contractors, agents, service providers, or other persons providing services to or on behalf of the organization holding the license. As an alternative to an EC license, some organizations may choose to license each external user with a separate CAL or CALs.
EC licenses may not be used as a means of reselling or repackaging Dynamics CRM as a hosted service.
Limited External Connector: The limited EC license allows external users read-only access to the CRM server. In other words, external users may access CRM information but may not make any edits or updates to it.
Full Use Additive External Connector: When used in conjunction with a limited EC license, a full use additive EC license allows external users write access to the CRM server, thus allowing full read-write access to the server. The full use additive EC license may be used only in conjunction with a limited EC license.
External Connector: The EC license provides external users full read-write access to the CRM server. The EC license is functionally equivalent to a combined limited and full use additive EC license.
Labels:
and Licensing,
CRM 4.0,
Editions,
Guide,
to Dynamics
Wednesday, October 27, 2010
Disabling Notes for deactivated records MS CRM
In the OnLoad event:
Code Snippet
/* [s] Disables the creation of new Notes, and editing of existing notes. Attachments can still be opened. */
//If the 'Close' button is showing, means that form Status = Resolved or Cancelled
var btnClose = document.getElementById("_MBwindowclose");
if (btnClose != null)
{
//Need to attachEvent, because IFRAME elements load asynchronously, and elements like 'newNoteButton' are not accessible on form load
var iframe = document.getElementById("notescontrol");
iframe.attachEvent('onreadystatechange', DisableNotes);
}
/* [e] */
The function DisableNotes:
Code Snippet
function DisableNotes()
{
//Hide 'Create a New Note' link
window.frames[0].document.getElementById('newNoteButton').style.visibility="Hidden";
var NotesTable = window.frames[0].document.getElementById('NotesTable');
//Disable the entire table
NotesTable.disabled = true;
var TextArea = NotesTable.getElementsByTagName('TEXTAREA');
//It's still necessary to individually disable the Textareas where users edit the existing notes.
for (i=0;i<TextArea.length;i++)
{
TextArea[i].disabled = true;
}
return;
}
Code Snippet
/* [s] Disables the creation of new Notes, and editing of existing notes. Attachments can still be opened. */
//If the 'Close' button is showing, means that form Status = Resolved or Cancelled
var btnClose = document.getElementById("_MBwindowclose");
if (btnClose != null)
{
//Need to attachEvent, because IFRAME elements load asynchronously, and elements like 'newNoteButton' are not accessible on form load
var iframe = document.getElementById("notescontrol");
iframe.attachEvent('onreadystatechange', DisableNotes);
}
/* [e] */
The function DisableNotes:
Code Snippet
function DisableNotes()
{
//Hide 'Create a New Note' link
window.frames[0].document.getElementById('newNoteButton').style.visibility="Hidden";
var NotesTable = window.frames[0].document.getElementById('NotesTable');
//Disable the entire table
NotesTable.disabled = true;
var TextArea = NotesTable.getElementsByTagName('TEXTAREA');
//It's still necessary to individually disable the Textareas where users edit the existing notes.
for (i=0;i<TextArea.length;i++)
{
TextArea[i].disabled = true;
}
return;
}
Labels:
Disabling,
for deactivated,
ms crm,
Notes,
records
Wednesday, October 20, 2010
Displaying the Number of Notes on the Notes Tab
The Microsoft CRM default form layout displays the Notes section on a separate tab. I often hear complaints from users that they don't know if any notes have been added without first clicking that tab. Many people don't realize that just as with any other section, you can move the Notes section to another tab, just as you would any other section. So one approach that many of our users have liked is to place the Notes section on the first tab as shown below.
The script I used is shown below and should be added to the entity's form onLoad function. Since this approach is entirely script based, it should also work on CRM Online. The tab where the Notes section exists must be called Notes for the script to work.
var totalNotes = getTotalNotes(crmForm.ObjectId);
setNoteTabName(totalNotes);
function setNoteTabName(count) {
/* update note tab */
if (crmForm.FormType != 1) {
var cells = document.getElementsByTagName("A");
for (var i = 0; i < cells.length; i++) {
if (cells[i].innerText == "Notes") {
if (count > 0) {
cells[i].innerText = "Notes (" + count + ")";
document.all.crmTabBar.style.width = "auto";
}
break;
}
}
}
}
// Helper method to return the total notes associated with an object
function getTotalNotes(objectId) {
// Define SOAP message
var xml =
[
"<?xml version='1.0' encoding='utf-8'?>",
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" ",
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ",
"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">",
GenerateAuthenticationHeader(),
"<soap:Body>",
"<RetrieveMultiple xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>",
"<query xmlns:q1='http://schemas.microsoft.com/crm/2006/Query' ",
"xsi:type='q1:QueryExpression'>",
"<q1:EntityName>annotation</q1:EntityName>",
"<q1:ColumnSet xsi:type=\"q1:ColumnSet\"><q1:Attributes><q1:Attribute>createdon</q1:Attribute></q1:Attributes></q1:ColumnSet>",
"<q1:Distinct>false</q1:Distinct><q1:Criteria><q1:FilterOperator>And</q1:FilterOperator>",
"<q1:Conditions><q1:Condition><q1:AttributeName>objectid</q1:AttributeName><q1:Operator>Equal</q1:Operator>",
"<q1:Values><q1:Value xsi:type=\"xsd:string\">",
objectId,
"</q1:Value></q1:Values></q1:Condition></q1:Conditions></q1:Criteria>",
"</query>",
"</RetrieveMultiple>",
"</soap:Body>",
"</soap:Envelope>"
].join("");
var resultXml = executeSoapRequest("RetrieveMultiple", xml);
return getMultipleNodeCount(resultXml, "q1:createdon");
}
// Helper method to execute a SOAP request
function executeSoapRequest(action, xml) {
var actionUrl = "http://schemas.microsoft.com/crm/2007/WebServices/";
actionUrl += action;
var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("SOAPAction", actionUrl);
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
xmlHttpRequest.send(xml);
var resultXml = xmlHttpRequest.responseXML;
return resultXml;
}
// Helper method to return total # of nodes from XML
function getMultipleNodeCount(tree, el) {
var e = null;
e = tree.getElementsByTagName(el);
return e.length;
}
Naturally, all of the caveats apply...this code is presented as is and may not upgrade with future releases of Microsoft CRM.

This works, but I personally find it annoying as the the cursor will 'jump' down to the Notes section, sometimes scrolling past the info on top set of information, and you have less room to see multiple notes. Since I tend to keep the Notes section on its own separate tab, I wanted to find a way to let users know that data exists on that tab prior to clicking it. I created the following script to display the number of notes on the tab label as shown in the screen shot below.

The script I used is shown below and should be added to the entity's form onLoad function. Since this approach is entirely script based, it should also work on CRM Online. The tab where the Notes section exists must be called Notes for the script to work.
var totalNotes = getTotalNotes(crmForm.ObjectId);
setNoteTabName(totalNotes);
function setNoteTabName(count) {
/* update note tab */
if (crmForm.FormType != 1) {
var cells = document.getElementsByTagName("A");
for (var i = 0; i < cells.length; i++) {
if (cells[i].innerText == "Notes") {
if (count > 0) {
cells[i].innerText = "Notes (" + count + ")";
document.all.crmTabBar.style.width = "auto";
}
break;
}
}
}
}
// Helper method to return the total notes associated with an object
function getTotalNotes(objectId) {
// Define SOAP message
var xml =
[
"<?xml version='1.0' encoding='utf-8'?>",
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" ",
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ",
"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">",
GenerateAuthenticationHeader(),
"<soap:Body>",
"<RetrieveMultiple xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>",
"<query xmlns:q1='http://schemas.microsoft.com/crm/2006/Query' ",
"xsi:type='q1:QueryExpression'>",
"<q1:EntityName>annotation</q1:EntityName>",
"<q1:ColumnSet xsi:type=\"q1:ColumnSet\"><q1:Attributes><q1:Attribute>createdon</q1:Attribute></q1:Attributes></q1:ColumnSet>",
"<q1:Distinct>false</q1:Distinct><q1:Criteria><q1:FilterOperator>And</q1:FilterOperator>",
"<q1:Conditions><q1:Condition><q1:AttributeName>objectid</q1:AttributeName><q1:Operator>Equal</q1:Operator>",
"<q1:Values><q1:Value xsi:type=\"xsd:string\">",
objectId,
"</q1:Value></q1:Values></q1:Condition></q1:Conditions></q1:Criteria>",
"</query>",
"</RetrieveMultiple>",
"</soap:Body>",
"</soap:Envelope>"
].join("");
var resultXml = executeSoapRequest("RetrieveMultiple", xml);
return getMultipleNodeCount(resultXml, "q1:createdon");
}
// Helper method to execute a SOAP request
function executeSoapRequest(action, xml) {
var actionUrl = "http://schemas.microsoft.com/crm/2007/WebServices/";
actionUrl += action;
var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("SOAPAction", actionUrl);
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
xmlHttpRequest.send(xml);
var resultXml = xmlHttpRequest.responseXML;
return resultXml;
}
// Helper method to return total # of nodes from XML
function getMultipleNodeCount(tree, el) {
var e = null;
e = tree.getElementsByTagName(el);
return e.length;
}
Naturally, all of the caveats apply...this code is presented as is and may not upgrade with future releases of Microsoft CRM.
Labels:
Displaying,
of Notes,
on the Notes,
Tab,
the Number
Tuesday, October 19, 2010
File Repository for Microsoft Dynamics CRM 4.0
here is the link
http://a33ik.blogspot.com/2009/09/file-repository-for-microsoft-dynamics.html
thanks to andriy
http://a33ik.blogspot.com/2009/09/file-repository-for-microsoft-dynamics.html
thanks to andriy
Subscribe to:
Posts (Atom)