Thursday, June 18, 2015

CRM 2011 Quick Find Search results grid not showing header data

We have faced an issue with quick search not showing header data. fields are visible but data is not visible in the grid.

We have a Quote OOB entity and Quote Part which is a custom entity and has 1:N relationship with Quote

In the main navigation we have the quote part entity displayed under sales.

When we initially open the quote part entity grid it shows all the fields of quote and quote part with all the data visible.

Once i search with one of the quote part field it shows the NO OF RESULTS correctly but it returns the Quote related fileds empty.

After log of research and trail and error method we have found that the Quick find configuration has a problem.

No Fields were selected in Quote part quick find (Find Fields)  After we select the few fields in the FIND COLUMNS it started returning the data for the Quote attributes. Weird but true.

This is no where documented in SDK. So thought it will be helpful for anyone else who face the same issue

Here are the screenshots showing the error






Tuesday, June 16, 2015

Reload Form in CRM 2013

CRM 2013 form will not reload the entire form after saving the record this is by design.
 so as a work around is to use "Xrm.Utility.openEntityForm" provided in SDK which is supported in all browsers.

Modified on Field in CRM will always be updated on CREATE and UPDATE of the record so we will register a function on Change of Modified on field.

function modifiedon_onChange() {
    reloadFormAfterSave();
}

function reloadFormAfterSave() {
    setTimeout(function() {
        Xrm.Utility.openEntityForm(Xrm.Page.data.entity.getEntityName(), Xrm.Page.data.entity.getId());
    }, 500);

}



Wednesday, April 1, 2015

Fetch Xml to Get Workflow Id by Name

 <fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>  
  <entity name='workflow'>  
   <attribute name='workflowid' />  
   <attribute name='name' />  
   <attribute name='category' />  
   <attribute name='primaryentity' />  
   <attribute name='statecode' />  
   <attribute name='createdon' />  
   <attribute name='ownerid' />  
   <attribute name='owningbusinessunit' />  
   <attribute name='type' />  
   <order attribute='name' descending='false' />  
   <filter type='and'>  
    <condition attribute='type' operator='eq' value='1' />  
    <filter type='or'>  
     <condition attribute='category' operator='eq' value='0' />  
     <filter type='and'>  
      <condition attribute='category' operator='eq' value='1' />  
      <condition attribute='languagecode' operator='eq-userlanguage' />  
     </filter>  
    </filter>  
    <condition attribute='name' operator='eq' value='WORKFLOW NAME' />  
   </filter>  
  </entity>  
 </fetch>  

Thursday, March 5, 2015

New Line in SSRS Text box

=Fields!AddressLine1 + VBCRLF + Fields!AddressLine2 + VBCRLF + Fields!AddressLine3 

OP:
 Address1
 Address2
 Address3


Note: If VBCRLF is used first or last part the expression, it has no impact on result. If you want a line in the first or last, then use one more extra VBCRLF.

Thursday, February 26, 2015

Switch HTTP request object for browser compatability

 function GetRequestObject() {  
   if (window.XMLHttpRequest) {  
     return new window.XMLHttpRequest;  
   } else {  
     try {  
       return new ActiveXObject("MSXML2.XMLHTTP.3.0");  
     }  
     catch (ex) {  
       return null;  
     }  
   }  
 }  

Monday, August 25, 2014

Set Option Set by OptionSet Text

function SetValue(optionsetAttribute, optionText)
{
 var options = Xrm.Page.getAttribute(optionsetAttribute).getOptions();
 for(i = 0; i < options.length; i++)
 {
  if (options[i].text == optionText)
   Xrm.Page.getAttribute(optionsetAttribute).setValue(options[i].value);
 }
}
Calling of the function
SetValue("new_country", "India")

Thursday, July 3, 2014

Using ExecuteMultipleRequest to do bulk operations

Today i came across a nice feature provided in SDK which allows me to do bulk operations in a single call to the server.

For example if i have to create 1000 records within a plugin

The only way was to loop the collection of records and use Service.Create(entity);
This will create 1000 calls to the CRM and is time consuming.

Using ExecuteMultipleRequest you can perform this operation by only sending 1 request to the CRM.
Let see how this can be accomplished

Note: ExecuteMultipleRequest is available in CRM sdk update rollup 12 onwards

In the below example i am deleting 1000 records

 

  
ExecuteMultipleRequest BulkDeleteRequest = new ExecuteMultipleRequest()
                {
                    // Assign settings that define execution behavior: continue on error, return responses. 
                    Settings = new ExecuteMultipleSettings()
                    {
                        ContinueOnError = false,
                        ReturnResponses = true
                    },
                    // Create an empty organization request collection.
                    Requests = new OrganizationRequestCollection()
                };
 foreach (var item in recordstoDelete.Entities)
                {
                    DeleteRequest delRequest = new DeleteRequest() { Target = new EntityReference(item.LogicalName, item.Id) };
                    BulkDeleteRequest.Requests.Add(delRequest);
                }
                ExecuteMultipleResponse BulkDeleteResponse = (ExecuteMultipleResponse)service.Execute(BulkDeleteRequest);




Run-time limitations

  1. Maximum batch size –1000
  2. Throttling of concurrent calls – for Microsoft Dynamics CRM Online there is a limit of 2 concurrent ExecuteMultipleRequest executions per organization
In one of the blog post from Sonoma partner they claim that the performance is increased by 600%
Here is the link 
http://blog.sonomapartners.com/2013/01/executemultiplerequest-performance.html