Archive

Archive for October, 2014

Base and Extension base tables Merge error – Upgrade from CRM 2011 to 2013

October 29, 2014 Leave a comment

As we know till CRM 2011, CRM maintained two database tables for each Entity:

  • Base table for the out-of-the-box fields of an entity
  • Extension table for the custom fields added to an entity

With CRM 2013, Now there is just one entity table for a given entity.

So when you upgrade CRM 2011 to 2013 Organization using Deployment manager, both base & extension base tables will be merged automatically.

Refer this link on how to upgrade Organization from 2011 to 2013.

However, you might get merge error stating:

“This may exceed that the architectural limits of Microsoft SQL Server, and the merge operation will fail.”

Refer this link on how to fix the table merge error.

🙂

Advertisement

Network Error while accessing external service from CRM web resource

October 28, 2014 Leave a comment

We had a requirement to fetch and display data from external hosted service, on a HTML web resource  hosted in CRM.

So I created a HTML file with below logic to fetch data from external hosted service.

var xmlhttp = new XMLHttpRequest();
xmlhttp.open(‘POST’, {External Service URL}, false);

xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
// Success
}
}
}

The logic was working fine, when I tested individual HTML fine.

But when hosted in CRM, I was getting “Network Error”.

Reason :

  • Cross domain issue while accessing HTML from CRM

Fix :

  • Setting “Access data sources across domains” to “true” in IE browser solved the issue
Access data sources across domains

Access data sources across domains

🙂

Unable to get property ‘integer’ of undefined or null reference – Error jqGrid

October 25, 2014 Leave a comment

We got a requirement to display XML data in table format in HTML file. We opted jqGrid for binding xml and display the XML content.

$(“#grid”).jqGrid({ datatype: ‘xmlstring’, datastr: responseXml, xmlReader: { repeatitems: false, root: xmlRoot, row: xmlRow }

I was getting this exception when I was binding XML to the jqGrid Fix :

  • By referring “grid.locale-en.js” file in my HTML file solved the issue.(i.e., <script src=”../grid.locale.en.js”></script>)

Note : grid.locale-en.js is helper file which comes when you download jqGrid.

🙂

Passing data between web resources CRM 2013

October 21, 2014 Leave a comment

Assume you have 2 HTML web resources on your CRM form and you want to pass data from 1 resource to another, below are the steps. In my example I have 2 HTML pages with a Textbox and Button.  

Form with 2 Webresources

Form with 2 Webresources

On Button click, I am reading the value from current HTML page Textbox and setting in to other HTML resource. Below is the script on button click event.

               // Get the other web resource using ‘Parent.Xrm’ var otherResource = parent.Xrm.Page.ui.controls.get(‘{Webresource_SchemaName}‘).getObject().contentWindow; // Get the Text box control from other resource var txtBoxOtherResource = otherResource.document.getElementById(“txtPage2”).value; // Set the value to the Text box control txtBoxOtherResource.value = document.getElementById(‘txtPage1’).value;

Note : To get schema name of a webresource,

  • Open the Customizations form
  • Double click on the web resource and get it as mentioned below
Webresource Schema Name

Webresource Schema Name

🙂

Categories: CRM Tags: , ,

Using ‘No Lock’ in FetchXML CRM

October 16, 2014 Leave a comment

In one of our requirement we are retrieving records using FetchXML and we observed fetch taking long time when there are more concurrent user access.

Reason:

  • Records are being updated by other users when I perform Fetch

Fix :

  • Set “no-lock=’true'” in the FetxhXML as below

<fetch mapping=’logical’ no-lock=’true’>

</fetch>

🙂

Categories: CRM Tags: , ,

Aggregate Query Record Limit Exceeded – Exception in CRM

October 16, 2014 Leave a comment

I was getting below exception when using FetchXML aggregation to compute Average of one of my entities field.

AggregateQueryRecordLimit exceeded.  Cannot perform this operation.

My Fetch XML :

<fetch distinct=’false’ mapping=’logical’ aggregate=’true’>

<entity name=’new-expenses’>

<attribute name=’new_gross’ alias=’gross_avg’ aggregate=’avg’ />

</entity>

</fetch>”;

Reason :

  • FetchXML Aggregation has a limitation, by default its limited to performing aggregate queries on less than 50,000 records.

Fix :

  • We cannot change this limit on CRM online
  • On onpremise, we can increase the limit by changing ‘AggregateQueryRecordLimit’ column value of ‘MSCRM_CONFIG.Deployment Properties’ table.
  • Refer this link on how to change.

Aggregation using Fetch XML

One of the major differentiator between Query Expression Vs Fetch Xml is that you can perform Aggregation on result set using Fetch XML.

The following aggregate functions are supported:

  • sum
  • avg
  • min
  • max
  • count(*)
  • count(attribute name)

Refer this link

🙂

Exclude namespaces from XML using Jscript

In one of my requirement I had to parse XML and find node values.

 My XML looks as below

<NS1:Envelope xmlns:NS1=http://schemas.xmlsoap.org/soap/envelope/>

<QueryBalanceResult>

<NS1:AvailableCredit>17400</NS1:AvailableCredit>

</QueryBalanceResult>

</NS1:Envelope>

Since the XML has got namespaces I need to exclude namespaces before I find the node. 

Below is the logic to exclude namespaces

var xmlWithNamespaces={Your xml with namespaces};

var xmlWithNoNamespaces= xmlWithNamespaces.replace(/<(\/?)([^:>\s]*:)?([^>]+)>/g, “<$1$3>”);

🙂

 

 

Categories: Misc Tags: , , ,