Wednesday, August 29, 2012

Optimizing Microsoft .NET ThreadPool Settings for Microsoft CRM 2011

    You can modify parameters in the Machine.config file to accommodate a specific environment. However, if each .aspx page makes a Web service call to a single IP address, it is recommended to adjust these parameters as shown in the following table:

Thursday, March 22, 2012

Some useful functions for MS CRM 2011 Reports


Here is a couple of useful functions for MS CRM 2011 reports:


Function that used to remove the duplicate records
Public Shared Function RemoveDups(ByVal items As String) As String
         Dim noDups As New System.Collections.ArrayList()
        
         Dim SpStr
         SpStr = Split(items ,",")

         For i As Integer=0 To Ubound(Spstr)
                   If Not noDups.Contains(SpStr(i).Trim()) Then
                            noDups.Add(SpStr(i).Trim())                       
                   End If
         Next

         Dim uniqueItems As String() = New String(noDups.Count-1){}
         noDups.CopyTo(uniqueItems)
        
         Return String.Join(",", uniqueItems)
End Function

SharePoint 2010 Form Based authentication for MS CRM 2011 Plugins

Some time you need to add, delete, or update custom items in a list on the SharePoint 2010 when plugins in MS CRM is fired up. This simple function can save your time :)

Passing MS CRM 2011 CRMParameter from ribbon button to Silverlight application

It’s pretty cool when you can pass CRMParameters to Silverlight application. To do that we need to get “location” :

public static string GetCRMParametr()
{
     if (HtmlPage.IsEnabled)
    {
        dynamic location = (ScriptObject)HtmlPage.Window.GetProperty("location");
        string crmParametr = location.search;
        if(!string.IsNullOrEmpty(crmParametr))
       {
           return crmParametr
        }
    }

return null;
}

You can add some kind of dummy parser to extract guid’s from passed parameters:

Monday, October 31, 2011

How to copy Microsoft CRM 2011 organization on the same server.

There are many reasons to copy organizations, one of the most common - for testing purpose.
You can do as following:
1. Select a database in SQL Server Management Studio which will be copied (TEST_MSCRM). Right click on the target database -> Tasks -> Backup.


Useful JavaScript commands for Microsoft CRM 2011 - Part 2: Xrm.Page.data.entity.attributes

Useful JavaScript commands for Microsoft CRM 2011 - Part 2: Xrm.Page.data.entity.attributes
Xrm.Page.data.entity.attributes – provides methods to retrieve information and perform actions on attributes.
Command
Description
.addOnChange()
Sets a function to be called when the attribute value is changed.
.fireOnChange()
Causes the OnChange event to occur on the attribute so that any script associated to that event can execute.

Example:
Xrm.Page.getAttribute("CRMFieldSchemaName").fireOnChange();
.getAttributeType()
Returns a string value that represents the type of attribute.
.getFormat()
Returns a string value that represents formatting options for the attribute.
.getInitialValue()
Returns the initial value for Boolean or optionset attributes.

Attribute Types: Boolean, optionset
.getIsDirty()
Returns a Boolean value indicating if there are unsaved changes to the attribute value.
.getMax()
Returns a number indicating the maximum allowed value for an attribute.

Attribute Types: money, decimal, integer, double

Useful JavaScript commands for Microsoft CRM 2011 - Part 1: Xrm.Page.context

Useful JavaScript commands for Microsoft CRM 2011 - Part 1: Xrm.Page.context
Xrm.Page.context – provides methods to obtain information specific to the organization, user or parameters that were passed in the form of a query string.
Command

Description
.getAuthenticationHeader()
Returns the encoded header SOAP-request for Web service in the style of MSCRM 4.0.
.getCurrentTheme()
Returns the current user's Outlook theme.
.getOrgLcid()
Returns the value of the LCID for the main language of the organization.

Example:
Xrm.Page.context. getOrgLcid();
.getOrgUniqueName()
Returns the unique name of the organization.
.getQueryStringParameters()
Returns an array of key-value pairs passed in the query string.
.getServerUrl()
Returns the base server URL. When a user is working offline with Microsoft Dynamics CRM for Microsoft Office Outlook, the URL is to the local Microsoft Dynamics CRM Web services.
.getUserId()
Returns the GUID value of the SystemUser.id value for the current user.

Example:
Xrm.Page.context.getUserId();
.getUserLcid()
Returns the LCID value that represents the Microsoft Dynamics CRM Language Pack that is the user selected as their preferred language.

Example:
Xrm.Page.context.getUserLcid();
.getUserRoles()
Returns an array of strings representing the GUID values of each of the security roles that the user is associated with.

Example:
Xrm.Page.context.getUserRoles();
.isOutlookClient()
Returns a Boolean value indicating if the user is using Microsoft Dynamics CRM for Microsoft Office Outlook.

Example:
Xrm.Page.context.isOutlookClient();
.isOutlookOnline()
Returns a Boolean value indicating whether the user is connected to the Microsoft Dynamics CRM server while using Microsoft Dynamics CRM for Microsoft Office Outlook with Offline Access. When this function returns false, the user is working offline without a connection to the server. They are interacting with an instance of Microsoft Dynamics CRM running on their local computer.

Example:
Xrm.Page.context.isOutlookOnline();
.prependOrgName()
Adds the name of the organization to the specified path.