How to Install/ Uninstall Sample Data in CRM?

Follow the below steps to Install/ Uninstall Sample Data from Dynamics 365 CRM Online,

Step 1: Open Dynamics 365 Online. Goto Settings -> Data Management and click on Sample Data.

Sample Data Settings Under Data Management

Step 2: If you have not installed any Sample Data earlier, it will show Sample Data button. Click on it to import sample data given by CRM OOB.

Sample Data - Install Sample Data

Step 3: After clicking on it, Goto Imports under Data Management to see the Sample Data import records Status.

Sample Data - Imports Status

Step 4: Once all the records Status Reason change to Completed, we can Sample records in the Entities Specified in the Import Name.

For an Instance, below is the Contacts Sample Data imported during this operation,

Contacts Sample Data

Step 5: If you want to Uninstall the same data imported during this operation, Goto Settings -> Data Management and click on Sample Data.

Then click on Remove Sample Data button.

Remove Sample Data

Step 6: Records deletion status can be seen under Settings -> Data Management -> Bulk Record Deletion.

Bulk Record Deletion record Status

Hope you learned this feature in CRM :):):)

 

Advertisements

How to add/ edit/ remove subjects in CRM?

Subjects field is a commonly used in Products, Cases, Sales Literature and Articles. Using this, we can organize them in a Tree structure.

Follow the below steps to Add/ Edit/ Remove subjects.

Step 1: Go to Settings -> Business Management -> Subjects

Settings - Subjects - Business Management Setting

Step 2: Select the required Subject. Add/ Edit/ Remove subjects using Common Tasks Area.

In this below screen shot, I have selected Subject Products and added Product 1 and Product 2.

Subject Common Tasks Area

Step 3: Open New Case/ Articles record to see the updated Subjects.

Case Subject

Unified Service Desk 3.0.0 released

You can download Unified Service Desk 3.0.0 Version Package Deployer and Executables from the below links,

Name Size Download Link Description
Dynamics365-USD-3.0.0.859-PackageDeployer 85.4 MB Click here USD Package Deployer to install solution components in CRM
Dynamics365-USD-3.0.0.859-amd64 88.9 MB Click here 64 bit USD client
Dynamics365-USD-3.0.0.859-i386 88.9 MB Click here 32 bit USD Client

Click here to see “What’s new in Unified Service Desk 3.0.0

OnOrAfter Vs Greater than for DateTime field in CRM

OnOrAfter:

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();
 do
 {
 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)
 {
 page++;
 cookie = string.Format("paging-cookie='{0}' page='{1}'", System.Security.SecurityElement.Escape(collection.PagingCookie), page);
 }
 Console.WriteLine(entityCollection.Entities.Count);
 } 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>" +
"</fetch>";

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)
 {
 contactFinalEntityCollection.Entities.AddRange(contactEntityCollection.Entities);
 }

moreRecords = contactEntityCollection.MoreRecords;
 }

return contactFinalEntityCollection;
 }