OnOrAfter Vs Greater than for DateTime field in CRM


This operator will consider Only Date but not Time to filter records.

Greater than:

This operator will consider both Date and Time.

By default both takes Time as 12:00 AM, if we don’t give any time and fetch records.

Retrieve 5000+ records using FetchXML and Query Expression

In my previous post, explained how to Retrieve 5000+ entity records using Query Expression,

In this post, will explain how to Retrieve 5000+ entity records using FetchXML and Query Expression.

Example: Retrieve All contact records where MobilePhone data is not null.

use below method,

public static EntityCollection RetrieveAllRecordsUsingFetchXML(IOrganizationService service, string fetchXML)
 var moreRecords = false;
 int page = 1;
 var cookie = string.Empty;
 var entityCollection = new EntityCollection();
 var xml = string.Format(fetchXML, cookie);
 var collection = service.RetrieveMultiple(new FetchExpression(xml));

if (collection.Entities.Count > 0) entityCollection.Entities.AddRange(collection.Entities);

moreRecords = collection.MoreRecords;
 if (moreRecords)
 cookie = string.Format("paging-cookie='{0}' page='{1}'", System.Security.SecurityElement.Escape(collection.PagingCookie), page);
 } while (moreRecords);

return entityCollection;

Get the required FetchXML from CRM Advanced Find and format using FetchXML Formatter Online.

For the example stated above, required FetchXML is as follows,

string fetchXML = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false' {0}>" +
" <entity name='contact'>" +
" <attribute name='fullname' />" +
" <attribute name='mobilephone' />" +
" <attribute name='contactid' />" +
" <order attribute='fullname' descending='false' />" +
" <filter type='and'>" +
" <condition attribute='mobilephone' operator='not-null' />" +
" </filter>" +
" </entity>" +

Note: Do not forget to append {0} in the first line of the formatted FetchXML.

How to Call Method?

EntityCollection contactCollection = RetrieveAllRecordsUsingFetchXML(_orgService, fetchXML);
Inspired from MS Dynamics CRM – Tips from a Developer Blog

Retrieve 5000+ entity records using Query Expression

Example: Retrieve All contact records where MobilePhone data is not null.

public EntityCollection RetrieveAllContactEntityRecords(IOrganizationService _service) {
 // Declarations
 var contactFinalEntityCollection = new EntityCollection();
 EntityCollection contactEntityCollection = new EntityCollection();
 int pageNumber = 1;
 bool moreRecords = true;

// Retrive Contact Records using CRM Paging.
 while (moreRecords)
 var queryExpression = new QueryExpression()
 Distinct = false,
 EntityName = "contact",
 ColumnSet = new ColumnSet(true),
 Criteria = new FilterExpression
 FilterOperator = LogicalOperator.And,
 Conditions =
 new ConditionExpression("mobilephone", ConditionOperator.NotNull)
 Orders =
 new OrderExpression { AttributeName = "createdon", OrderType = OrderType.Descending }
 PageInfo =
 Count = 5000,
 PagingCookie = (pageNumber == 1) ? null : contactEntityCollection.PagingCookie,
 PageNumber = pageNumber++

contactEntityCollection = _service.RetrieveMultiple(queryExpression);

if (contactEntityCollection.Entities.Count > 0)

moreRecords = contactEntityCollection.MoreRecords;

return contactFinalEntityCollection;

How to Customize Lookup Views in CRM?

Will see how to customize a Lookup View with an example.


Customer requirement is to have “Ticker Symbol” instead of Phone” in Customer Lookup for Account in Case Entity.

Customize Lookup - Example

As per the above screenshot, can see Account Name, Email and Phone.

Now, we have to replace Phone with Ticker Symbol.

Please follow the below steps to do so,

Step 1: Go to Account Entity Customization -> Views -> Account Lookup View.

We can see the Account Name, Email and Phone in Out of the box View. Add Ticker Symbol after Email.

Note: As per the Order of First three columns, Lookup View displays.

Customize Lookup - Example - Account Lookup View

Step 2: Save and Close the View. Publish the Account Entity Only.

Step 3: Open new Case Entity record and search for the required Account record in Customer Lookup to see the changes.

Customize Lookup - Example - Account Lookup View with Ticker Symbol

Note: If the Account record has no data for Ticker Symbol, it will be displayed as Empty.

Hope you learned a new thing today :):):)


Principal User is missing prvReadIncident privilege

Got the below issue when i am trying to assign a record to a Team via Action from Incident entity field update from CRM Webform,

Principal User is missing prvReadIncident privilege

I have searched in google for this error and found so many blogs and forums, majority of them saying, to change the Access Mode to Read-Write in System User entity for the user who is facing this issue. User is having Read-Write in my case, but still i faced this issue.

Finally i found that, somehow the Team got converted to Access Team, which i am assigning from Action.

I converted the team from Access Team to Owner Team.

Still, i faced the issue and found that there is no security role assigned to the Owner Team.

At last assigned required Security role to the Team and issue resolved.

Hope this helps and resolves your issue 🙂


QuickFindQueryRecordLimit exceeded. Cannot perform this operation in CRM

I am facing the below issue, when the user is searching for a Text in Contact’s Home Page grid view.

QuickFindQueryRecordLimit exceeded. Cannot perform this operation

Root cause: User is searching for a Text in Contact’s Home Page grid view and there are having more than 10,000 records.

Due to this limitation in CRM for Quick Find Search, CRM Platform is throwing this issue.

Solution: Goto Settings -> Administration -> System Settings

Change the Enable Quick Find record limits under Set up Quick Find to No and click on OK.

Quick Find Settings in System Settings

Now you can search the required Text without any issues.

Hope this resolves your issue.