Today I want to share something about the practical problem which I faced with OData retrieve Limit and how I over come that.
My development Team used OData retrieve Responses methods to fetch the Team Members in CRM 2011. Everything went well till last week. Last week few more used joined to our team. So as a Project Manager I added them into my team. But after that when we tried to check those members in the required place we did not find them. Now my turn came to check for the cause and to fix the issue.
When I check the details, My first observation is the OData Retrieve Response limit. By default is 50 as per the Microsoft Dynamics CRM settings.
Now My initial step is to increase the 50 records Page list on OData retrieve Responses via an advanced configuration setting stored in MSCRM_Config.
The specific setting that imposes the 50 record limit is called ‘MaxResultsPerCollection’ and it’s part of the ServerSettings configuration table. We can get more description of MaxResultsPerCollection and other ServerSettings from this link: http://msdn.microsoft.com/en-us/library/gg334675.aspx.
Advanced configuration settings can be modified either programmatically via the Deployment Service or via PowerShell cmdlet. The CRM 2011 SDK provides an example of how to set an advanced configuration setting via the Deployment Service here: http://msdn.microsoft.com/en-us/library/gg328128.aspx
To update the setting via PowerShell, we have to execute each of the following at the PowerShell command-line:
$setting = New-Object “Microsoft.Xrm.Sdk.Deployment.ConfigurationEntity”
$setting.LogicalName = “ServerSettings”
$setting.Attributes = New-Object “Microsoft.Xrm.Sdk.Deployment.AttributeCollection”
$attribute = New-Object “System.Collections.Generic.KeyValuePair[String, Object]” (“MaxResultsPerCollection”, 75)
Set-CrmAdvancedSetting -Entity $setting
Alternatively, we can use the PowerShell script which was provided in the CRM 2011 SDK to update advanced configuration settings: [SDK Install Location]\samplecode\ps\setadvancedsettings.ps1
To be able to execute scripts, we must first set our PowerShell execution policy to allow unsigned local scripts by using the following command
Then, we have to execute the ‘setadvancedsettings.ps1’ PowerShell script from the SDK and pass in the configuration entity name (string), attribute name (string), and new value (Int32).
& “[SDK Install Location]\setadvancedsettings.ps1” “ServerSettings” “MaxResultsPerCollection” 75
After performing either of the two methods above to update our setting, we can verify that the change was successful by inspecting the ServerSettingsProperties table in MSCRM_Config database.
[ID], [ColumnName], IntColumn
ColumnName = ‘Maxresultspercollection’
Now I tried my First Option(Executing PowerShell commands) to set the MaxResultsCollection Option to 75 on my DEVELOPMENT region. It worked fine and excellent.
Now I tried the same steps on my UAT region. it did not execute properly and I got the issue by saying that
Set-CrmAdvancedSetting : The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
Now Again I started my RND on this. I tried to recollect all the differences on my both (DEV and UAT) environments. The only difference is the IFD configuration on UAT region. Now I understood that the problem with the Web Address settings on UAT server (Microsoft Dynamics CRM Properties).
When I check the Details (Microsoft Dynamics CRM Properties) via Microsoft Dynamics CRM Deployment Manager I found that all the WEB Address Settings are pointing to LOCAL Server not to the IFD. Now my immediate action is to update the settings to point to IFD.
With the Help of My Network administrator we update the setting to point to appropriate IFD URLs.
Now after that I executed the PowerShell commands on my UAT server. 🙂 Now all commands got executed and we are getting the required results in our output.
Hope it helps! 🙂