Solution history in Dynamics 365 – Audit of Solution

“Sometimes history repeats itself. And sometimes it doesn’t.” – Adam Curtis

I agree with Adam about history thought. We can’t predict that history will repeat or will not. Somewhat same thing we can see in latest version of CRM as well. In previous version of Dynamics CRM, it was very critical job to identify audit history of solutions such as type of operation performed (imported, exported or uninstalled), total time required to perform the operation, etc.

With the help of solution history, we can keep track of both the solutions, unmanaged as well as managed solution. Now let see step by step how we can configure solution history in MS Dynamics CRM (customer engagement)

1. Navigate to Settings -> Customization and click on “Solution History”.

1.jpg

2. Select the view provided by CRM from the list. Here is the place where you can see solution history records.

2

3. Open the solution history record. Here you will be able to see following details of solution:

  • Solution Name
  • Solution version
  • Publisher Name
  • Sub operation
  • Operation Name (Import, export or uninstall)
  • Managed (Denotes type of solution whether it is managed or not)
  • Start Time – Denotes time of operation on solution started.
  • End Time – Denotes time of operation on solution completed.
  • Total Time (Seconds) – Time required to complete the operation.
  • Result – Success/Failed.

3

If you have noticed here, record is in read only mode. Even system administrator also can’t edit or clear the solution history since it is in read only format because we don’t have any option to provide the access of apart from “read”, “append” and “append to” inside security role.

4

 

In case if you want to read all columns of solution you can use “advance find” to search the solution history data. Also, for reporting purpose you can download the solution history records using “Export solution history” button on top of the advance find window.

5

Hope this help you 👍

Change X axis and Y axis labels in CRM chart

Working as CRM consultant I found dashboard as mostly useful tool to visualize data in list as well as in chart format. Using list, we can show number of records in grid whereas using chart we can show data in bar, pie, line etc format.

Recently one of my colleague asked me to explore chart in details with custom properties. In this blog I will explore about data labels in chart. Let see how we can change labels of X and Y axis in chart.

Steps:

1. Navigate to the dashboard on which you have to update chart.

In my case, I’m using Marketing dashboard and want to change the labels of X and Y axis of campaign budget vs actual costs (by month)

Click on middle button icon available on top right corner of chart as shown in below snapshot.

1

Here I have selected x axis as Month (Actual end date) field of campaign.

2. Inside new popup template window, click on ‘Action’ button and select “Export Chart”.

Save file with extension as .xml

2

3. Open downloaded file in Visual studio or Notepad ++ and search for keyword ‘ChartAreas’

This is the place where we can define our own properties for Axis ‘X’ and Axis ‘Y’. In my case I have added here Title of ‘X’ axis as “Month” whereas “Campaign Budget” as axis ‘Y’

Title X = “Month”

Title Y = “Campaign Budget”

3

4. Finally you can import chart in crm as shown in below snapshot. There is one options available while importing chart to create chart with new name or also you can update same chart as well.

4

Once you click on import button changes will reflect in chart.

5

There are couples of properties available for ChartAreas that you can use to modify OOB chart such as TitleForeColor, TitleFont etc to visualize data for different user experience.

Cheers with this feature and define your own variety of designs in chart rather than creating SSRS report.

Pratibha, I appreciate your thought, assistance and input….

Hope this help you 😊

Open in Excel Online – MS Dynamics 365 excel online

Editing and importing records is much easier task in MS CRM for users. In case of bulk edit of records, we can use data import functionality.

 

Let us see step by step how we can use new feature of Dynamics CRM that help us to import as well as create data using ‘Open in Excel Online’ feature.

1. Navigate to module of CRM (such as Sales, service) -> Entity

2. Select view from the list that you need to update record. Select Export to Excel fly out on ribbon button and click on ‘Open in Excel Online’

1

3. It will redirect to excel application online with view data. Here is the place where you can bulk update or create records directly in CRM.

Once you done with changes click on “Save Changes to Dynamics 365” button to submit data.

2.png

4. After submitting data alert message will trigger with data submitted notification. Click on close button on popup window.

3

Once click on refresh list icon to reflect new values in entity view. Finally, you can see updated data in CRM view.

 

This feature is useful in below situations:

A. In case if you want to update read only records without reopening it.

For ex. If you want to update Inactive accounts without reactivating it.

B. If you want to update records in bulk.

C. Any crm user can easily use this feature in CRM online to edit/update data.

D. Any particular view can update with sequence value

For ex. Auto number sequence.

Hope this help you 😊

Hide ribbon button on view (Home grid) if one or more records selected in view

Recently I had one requirement to hide “Run Report” on home page button if one or more records selected in view list.

Magic becomes art when it has nothing to hide. – Ben Okri

Same way I found one magic in CRM using OOB functionality to show button if nothing selected and hide if at least one selected in home grid.

 

Let see step by step how I did this:

1. Create Javascript web resource and add below code in it.

///==========================================================================

/// Description : Hide View Run report button

/// Created By  : PRAVIN

/// Event       : Ribbon button – Enable rule

HideReport = function(selectedIds)

{

    try {

        if (selectedIds.length > 0)

            return false;

        else

            return true;

    }

    catch (error) {

        alert(‘HideReport function error: ‘ + error);

    }

}

///==========================================================================

2. Either download ribbon workbench solution from here https://www.develop1.net/public/rwb/ribbonworkbench.aspx and import into your CRM organization.

Or

Download Xrm Toolbox from here https://www.xrmtoolbox.com/ and connect to your CRM instance. Select ribbon workbench plugin in plugin store and install it.

3. Click on “Ribbon Workbench” and select your solution from the list as shown in below screenshot.

1

4. Select entity name from list available in solution you have selected in ribbon solution at left bottom corner.

5. Inside ribbon workbench tool go to the Home section and scroll horizontally to select button.

6. Select button that you want to hide/show in home page. In my case I have to hide run report button.

7. Right click on button and select customize command button.

2

8. Now customized command will be visible in solution element. Select command “Mscrm.ReportMenu.Grid” and add Enable Rule inside properties command.

 

9. Type Id of button Id text. Click on Add Step and select ‘CustomRule’ from dropdown list

10. Inside CustomRule select Default value as True and InvertResult as False.

3

11. Type FunctionName and select your web resource in library textbox as shown in above screenshot. Once done with adding rule into command click on publish.

12. To get count of selected records click on “Add Parameter” and select CRM Parameter from the list. Select ‘SelectedControlAllItemIds’ as parameter.

5

13. After publishing solution, refresh CRM window once and navigate to view of entity.

You will be able to see “Run Report” if none of record selected in view. Vice versa if you select one or more than record in view button will be hidden.

4

This magic works fine in entity associated sub grid as well.

Hope this helps you 😊

Retrieve option-set values and labels without use of metadata request in Plugin and JavaScript

Metadata is the place of database where we can retrieve information about structure of database such as attribute properties, length, max-size etc. In most of the requirement we need to retrieve option set values in java-script as well as plugin.

1. If we use Xrm library to retrieve option-set value, we can get only selected option set value and label.

var OptionValue = Xrm.Page.getAttribute(“logicalnameofattribute”).getValue();

var OptionLabel = Xrm.Page.getAttribute(“logicalnameofattribute”).getText();

 

2. In case of plugin as well we can access only label and value of selected option.

int OptionValue = EntityObject.Attributes.Contains(“logicalnameofattribute”) ? EntityObject.GetAttributeValue<OptionSetValue>(” logicalnameofattribute”).Value : 0;

 

string OptionLabel = EntityObject.FormattedValues.ContainsKey(“logicalnameofattribute”) ? EntityObject.FormattedValues[“logicalnameofattribute”] : null;

 

“Any system is only as good as the metadata that it ingests.”
― Chris Bulock

 

I believe that MS Dynamics CRM is as easier as to retrieve metadata in Javascript and c# as well. Here I will show you how we can retrieve metadata of optionset without use of metadata request.

I will explorer here more with technical example how we can retrieve metadata of optionset using stringmap table.

 

A). Plugin:

Here I’m using fetch expression to retrieve stringmap table of account entity.

string EntityLogicalName = “account”;

string FieldLogicalName = “customertypecode”;

string FetchXml = @”<fetch version=’1.0′ output-format=’xml-platform’ mapping=’logical’ distinct=’false’>

<entity name=’stringmap’ >

<attribute name=’attributevalue’ />

<attribute name=’value’ />

<filter type=’and’ >

<condition attribute=’objecttypecodename’ operator=’eq’ value = ‘” + EntityLogicalName + @”‘ />

<condition attribute=’attributename’ operator=’eq’ value = ‘” + FieldLogicalName + @”‘ />

</filter>

</entity>

</fetch>”;

FetchExpression FetchXmlQuery = new FetchExpression(FetchXml);

EntityCollection FetchXmlResult = service.RetrieveMultiple(FetchXmlQuery);

if (FetchXmlResult.Entities.Count > 0)

{

foreach (Entity Stringmap in FetchXmlResult.Entities)

{

string OptionValue = Stringmap.Attributes.Contains(“value”) ? (string)Stringmap.Attributes[“value”] : string.Empty;

Int32 OptionLabel = Stringmap.Attributes.Contains(“attributevalue”) ? (Int32)Stringmap.Attributes[“attributevalue”] : 0;

}

}

 

 

B). JavaScript:

Using following API request we can get stringmap table in javascript

 

var req = new XMLHttpRequest();

req.open(“GET”, Xrm.Page.context.getClientUrl() + “/api/data/v9.1/stringmaps?$select=*&$filter=attributename eq ‘customertypecode’ and objecttypecode eq ‘account'”, false);

req.setRequestHeader(“OData-MaxVersion”, “4.0”);

req.setRequestHeader(“OData-Version”, “4.0”);

req.setRequestHeader(“Accept”, “application/json”);

req.setRequestHeader(“Content-Type”, “application/json; charset=utf-8”);

req.setRequestHeader(“Prefer”, “odata.include-annotations=\”*\””);

req.onreadystatechange = function() {

if (this.readyState === 4) {

req.onreadystatechange = null;

if (this.status === 200) {

var results = JSON.parse(this.response);

for (var i = 0; i < results.value.length; i++) {

var OptionLabel = results.value[i][“value”]; // Label

var OptionValue = results.value[i][“attributevalue”]; // Value

}

} else {

Xrm.Utility.alertDialog(this.statusText);

}

}

};

req.send();

 

C). SSRS Report (as optionset parameter):

One more use of stringmap entity is that we can use the same fetchxml to create dataset and pass parameter of optionset in place of hard coded value.

<fetch version=’1.0′ output-format=’xml-platform’ mapping=’logical’ distinct=’false’>

<entity name=’stringmap’ >

<attribute name=’attributevalue’ />

<attribute name=’value’ />

<filter type=’and’ >

<condition attribute=’objecttypecodename’ operator=’eq’ value=‘account‘ />

<condition attribute=’attributename’ operator=’eq’ value=’customertypecode‘ />//Field logical Name

</filter>

</entity>

</fetch>

 

 

Hope this will help you 😊

SQL Server Reporting Services (SSRS) Report Development (Adding parameters to report)– Part 2

In previous blog I have explored about how to start with SSRS reports.

https://pravinpawarweb.wordpress.com/2019/06/20/sql-server-reporting-services-ssrs-report-development-part-1/

“In the Information Age, the first step to sanity is FILTERING. Filter the information: extract for knowledge.” ― Marc Stiegler, Davids Sling

 

In this article will explore more about SSRS report like filtering report with the help of parameters and adding chart in report.

 

Step 1: Follow the steps to create new report as mentioned in first blog

Step 2: While adding query in Dataset type “@parametername” after value as shown in below screenshot.

1

2

Step 3: In my case I’m passing IndustryId, start date and end date as parameter where IndustryId is GUID of industry records. To pass multiple GUID of records create new dataset with master entity records as shown in below screenshot.

3

Step 4: Double click on IndustryId parameter and select available values in “Report Parameter Properties” to set IndustryId as GUID and Industry Name as parameter display name.

4.png

Step 5: In General section select data type as text, tick on “Allow blank value (“”)” and “Allow multiple values” to pass Id as optional or multiple values in IndustryId.

5.png

Step 6: Change data type of start date and end date as “Date/Time”. In my case start date and end date is createdon field.

6

Step 7: Add and update table/matrix as suggested in first blog.

7

Step 8: To add chart in report right click inside report and select chart option. Here we can create different types of chart such as column, shape, line etc. Select chart type and click on OK button.

8.png

Step 9: After adding chart click on chart to add series groups, category groups and aggregate function expression. You can preview groups in legend section. To show values inside chart right click on chart and select show data tables. Charts are useful to show statistical report in graphical format.

9.png

Finally upload report in CRM and click on run report to view chart. While running report you need to pass parameters to filter report.

10.png

 

Hope this help you 👍

 

 

 

SQL Server Reporting Services (SSRS) Report Development – Part 1

“The financial report makes it very clear that if we got into honest budgeting today, that in fact we would find ourselves with a much larger deficit than we have today”. Jim Costa.

 

To develop custom SSRS reports you must have to complete installation of SQL Server Reporting Services as well as MS Dynamics CRM Reporting Extension.

To download this setup, you can refer below urls:

https://docs.microsoft.com/en-us/previous-versions/mt429383(v=msdn.10)

https://www.microsoft.com/en-us/download/details.aspx?id=50375

After installation of above setup, we can develop FetchXml as well as SQL query based reports.

Let see step by step how we can develop and deploy SSRS report (using FetchXml)

1. Navigate to File -> New -> Project -> Expand Business Intelligence and select Reporting services.

Type name of project and select location of your machine to create and store report.

2. After creating project right click on Reports and select New Item.

1

3. Navigate to View in Visual Studio and select “Report Data” to add Data source and Dataset

Right click on Data Source and select Add Data Source. In Data Source Properties window, you can see to sections as ‘General’ and ‘Credentials’.

Type name of data source and select type of Embedded connection as “Microsoft Dynamics 365 Fetch” option from the drop-down list.

Type connection string as your org URL and org unique name (available inside Settings -> customization’s -> developer resources)

2

4. In Credentials section select “Use this username and password”. Type username and password of CRM user and click on OK button.

3

5. Now right click on Datasets and select Add Dataset. In Dataset properties type name of dataset, select “Use a dataset embedded in my report.” Choose newly created data source and in query type select Text radio button. Paste fetch xml in query text area (you can download it from Advance find -> Download FETCH XML)

4

6. After adding Data source and dataset right click inside report and add header and footer.

5

7. Right click in report and select insert table/matrix. New table will be created with empty columns and rows.

Type column names and bind rows with dataset fields.

6

You can also modify field value with customized expression. Right click on inside Text-box and select Expression. On Expression window you can choose all possible operators, functions to customize text-box value.

7

8. Login in to CRM with System Administrator and Navigate to Sales/Service/Marketing and click on ‘Report’ on sitemap area

Click on New button. It will open new window, expand Report type and select ‘Existing File’ and click on choose file and upload the .rdl file. Name will automatically populate on form moreover you can update it if required.

Choose the categories as where you want to execute report (Sales, service, marketing etc). Select the primary entity where you want to get values and execute report.

 

In Display In option choose required options, in my scenario I’ve created summary report and that’s why I’ve selected as ‘Report Area’.

8

Click on save or save and close button.

9. Finally, you can see your custom report in report list view. Select the report and click on “Run Report” button.

9

 

You will be able to see report in window where you can download report in .pdf, word, Excel, PowerPoint etc format.

 

In next blog I will explore more about SSRS report such as matrix reports, filter and parameters in report.

 

 

Hope this help you 👍

Dynamics 365 email configuration and Email server setup

I do love email. Wherever possible I try to communicate asynchronously. I’m really good at email. -Elon Musk

 

A key feature of MS Dynamics CRM is about sending email using Exchange server. CRM allows us to send email using email templates.

Let see step by step how we can configure  email server on MS CRM online version.

  1. Login to dynamics 365 using credentials and navigate to ‘Microsoft 365 admin center’

Select or create new user from and manage user licenses. For email server profile, user should have ‘Exchange Online’ subscription.

1

 

  1. After adding subscription to user open outlook and add your 365 user account in outlook account. Click on connect button.

 

2

3. Type your password and click on sign in button3

4. Yes, now you are account is added in outlook.4

 

5. Now login and open CRM and Navigate to Settings->Email Configuration.

 

5

6. Open ‘Email Configuration Settings’ to set email settings

6

7. Update Incoming, Outgoing profile as ‘Server-side synchronization or email router’ option and Appointments, contacts and task profile as ‘Microsoft Dynamics 365 outlook’ from the option.

7

8

9. Click on ‘Test and Enable Mailbox’ button and check Incoming and outgoing Email status. It should update as ‘Success’ on successful configuration.

9

10. Now Open ‘Email Server Profile’ and select your mailbox option from the list. Click on ‘Approve Email’ button on ribbon.

11

12

13

You can see ‘success’ message in incoming and outgoing email status

11. Now open your outlook and select Microsoft account from the list. There will be one email of Email tracing from Exchange server

14

12. Now create email in Dynamics CRM with from, to and attachment options. Click on save and then send button to send email.

15

16

Finally you will be able to see in your inbox new email from CRM user.

Hope this help you 👍

 

Calling action using JavaScript in MS CRM

Quality is decided by the depth at which the work incorporates the alternatives within itself, and so masters them. Theodor W. Adorno

While starting with my career in MS CRM 2011 there was some challenges to handle events. Sometimes in tedious requirement we need to call our own custom event such as call plugin using JavaScript without any flag, create and open activities, alert after record creation, alert after email sending, WEB API call etc. CRM 2013 on-wards we can use action to define our own message name. In short, we can use action as a mediator between JavaScript, Plugin, Custom Activity and Workflow.

 

Types of actions:

Action can be created for single entity as well as global for all entities. Here global refers to dynamic context of entity.

Here I’m creating sample action to call WEB API and show response in MS CRM

  1. Navigate to Settings -> Processes

Click on new button on ribbon and type process name, select category, entity as global (in case if you want to create as global action irrespective of particular entity. Here I’m using global action)

1

  1. Inside “Hide Process Arguments” click on + icon to add input and output parameter. You can select any types of input and output parameter as given in below image.

2

3. After adding input and output parameters click on ‘Activate’ button on ribbon. Copy the name of action that we need to call in JavaScript.

3

  1. Create JavaScript function to call action and get response from custom action as shown in below format.

//Main function

CallWebAPIAction =  function() {

try {

var url;

url = “new_CallWebAPIusingCustomAction”; // Action Name

var parameters = {};

parameters.FirstParameter = Xrm.Page.getAttribute(“fieldlogicalname1”).getValue();

parameters.SecondParameter = Xrm.Page.getAttribute(“fieldlogicalname2”).getValue();

 

callCustomAction(url, OutputResult, parameters);

}

catch (error) {

alert(‘function Error: ‘ + error.message);

}

}

 

//Ouput Function

OutputResult = function(result) {

try {

var FirstResult = result[“FirstResult”];

var SecondResult = result[“SecondResult”];

}

catch (error) {

alert(‘function Error: ‘ + error.message);

}

}

 

 

//Call custom action function

callCustomAction = function (uri, successCallback, data){

try {

if (data) {

data = JSON.stringify(data);

}

var req = new XMLHttpRequest();

req.open(“POST”, Xrm.Page.context.getClientUrl() + “/api/data/v8.2/” + uri, false);

req.setRequestHeader(“Accept”, “application/json”);

req.setRequestHeader(“Content-Type”, “application/json; charset=utf-8”);

req.setRequestHeader(“OData-MaxVersion”, “4.0”);

req.setRequestHeader(“OData-Version”, “4.0”);

req.onreadystatechange = function () {

if (this.readyState == 4) {

req.onreadystatechange = null;

if (this.status == 200) {

var result = JSON.parse(this.response)

successCallback(result);

}

else {

var errorText = this.responseText;

Xrm.Utility.alertDialog(errorText);

}

}

};

req.send(data);

}

catch (error) {

alert(‘function Error: ‘ + error.message);

}

}

 

  1. Create custom action code (Class library & add snk file) and register dll using “Plugin Registration Tool” as shown in below:

using System;

using System.Collections.Generic;

using System.Collections.Specialized;

using System.IO;

using System.Linq;

using System.Net;

using System.Runtime.Serialization.Json;

using System.Text;

using System.Threading.Tasks;

using System.Xml;

using System.Xml.XPath;

using Microsoft.Xrm.Sdk;

using Microsoft.Xrm.Sdk.Query;

 

namespace Aston_Plugin

{

public class Custom_Action

{

public void Execute(IServiceProvider serviceProvider)

{

ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));

try

{

IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));

IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));

IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

 

string FirstParameter = context.InputParameters[“FirstParameter”].ToString(); // Session Id

string SecondParameter = context.InputParameters[“SecondParameter”].ToString(); // Access Token

if (context.MessageName == “new_CallWebAPIusingCustomAction”)

{

string sessionCallId = FirstParameter;

string DomainName = SecondParameter;

string postUrl = “https://&#8221; + DomainName + “/Call/End/” + sessionCallId;

tracingService.Trace(“PostUrl… ” + postUrl + Environment.NewLine);

 

HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(postUrl);

httpWebRequest.Headers.Add(HttpRequestHeader.Authorization, “Bearer ” + SecondParameter);

httpWebRequest.Method = “GET”; //GET OR POST Method

httpWebRequest.Host = DomainName;

 

HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();

StreamReader sr = new StreamReader(httpWebResponse.GetResponseStream());

string result = sr.ReadToEnd();

 

context.OutputParameters[“FirstResult”] = result;

context.OutputParameters[“SecondResult”] = result;

}

}

catch (Exception ex)

{

tracingService.Trace(“Error occured in plugin… ” + ex.Message);

}

}

}

}

 

Finally, you can call JavaScript on any ribbon button or any event of form and you will get result in action response.

Using Action as inter-mediator we can get plugin response in JavaScript with custom message name.

 

ALTERNATIVE WAY IS ALWAYS COMBINATION OF ALL POSSIBLE WAYS 😊

Hope this help you 👍

Plugin code to retrieve more than 5000 records using Fetch XML in CRM

“Do just once what others say you can’t do, and you will never pay attention to their limitations again.”–James Cook

When I was working on one project I found some limitations of Query Expression and Fetch Expression. After some R&D I found that we can override one of them limitation i.e retrieving records more than 5000 at a time using ‘PagingCookie’.

 
Here I’m sharing one sample code to retrieve more than 5000 records using the Fetch XML.

 

public void RetrieveContacts() // Code created in console application
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
Microsoft.Xrm.Client.CrmConnection connection = CrmConnection.Parse(GetServiceConfiguration());
service = new OrganizationService(connection);
{
try
{
int fetchCount = 5000; // You can define upto 5000 value
int pageNumber = 1;
string pagingCookie = null;

string ContactsXml = @”<fetch version=’1.0′ output-format=’xml-platform’ mapping=’logical’ distinct=’false’>
<entity name=’contact’>
<attribute name=’fullname’ />
<attribute name=’telephone1′ />
<attribute name=’contactid’ />
<order attribute=’fullname’ descending=’false’ />
<filter type=’and’>
<condition attribute=’statecode’ operator=’eq’ value=’0′ />
</filter>
</entity>
</fetch>”;
FetchExpression ContactsXmlQuery = new FetchExpression(ContactsXml);
EntityCollection ContactData = service.RetrieveMultiple(ContactsXmlQuery);
if (ContactData.Entities.Count > 0)
{
while (true)
{
foreach (Entity Contact in ContactData.Entities)
{
//Your logic here
}
if (ContactData.MoreRecords)
{
pageNumber++;
pagingCookie = ContactData.PagingCookie;
EntityCollection ContactDataColl = ContactData;
ContactData = GetMoreRecords(ContactDataColl, pageNumber, ContactsXml, pagingCookie, fetchCount);
}
else { break; }
}
}
}
catch (Exception ex)
{
throw new InvalidPluginExecutionException(ex.Message);
}
}
}
public static string CreateXml(XmlDocument doc, string cookie, int page, int count)
{
XmlAttributeCollection attrs = doc.DocumentElement.Attributes;
if (cookie != null)
{
XmlAttribute pagingAttr = doc.CreateAttribute(“paging-cookie”);
pagingAttr.Value = cookie;
attrs.Append(pagingAttr);
}

XmlAttribute pageAttr = doc.CreateAttribute(“page”);
pageAttr.Value = System.Convert.ToString(page);
attrs.Append(pageAttr);

XmlAttribute countAttr = doc.CreateAttribute(“count”);
countAttr.Value = System.Convert.ToString(count);
attrs.Append(countAttr);

StringBuilder sb = new StringBuilder(1024);
StringWriter stringWriter = new StringWriter(sb);

XmlTextWriter writer = new XmlTextWriter(stringWriter);
doc.WriteTo(writer);
writer.Close();

return sb.ToString();
}

 

public EntityCollection GetMoreRecords(EntityCollection ContactData, int pageNumber, string ContactXml, string pagingCookie, int fetchCount)
{
string xml = CreateXml(ContactXml, pagingCookie, pageNumber, fetchCount);
RetrieveMultipleRequest fetchRequest = new RetrieveMultipleRequest
{
Query = new FetchExpression(xml)
};
ContactData = ((RetrieveMultipleResponse)service.Execute(fetchRequest)).EntityCollection;
return ContactData;
}

 
public static string CreateXml(string xml, string cookie, int page, int count)
{
StringReader stringReader = new StringReader(xml);
XmlTextReader reader = new XmlTextReader(stringReader);
XmlDocument doc = new XmlDocument();
doc.Load(reader);
return CreateXml(doc, cookie, page, count);
}

 

So, every problem itself designed with solution like above limitation. 😊

 

Hope this helpful 👍