Fixed – Azure Synapse Link for Dataverse not starting

Recently while trying to configure “Azure Synapse Link for
Dataverse” for one of our environments, we faced an issue, where it got stuck as shown below.

Also, there were no files/folders created inside the Storage Account.

Posts on Azure Data Lake

The accounts were properly setup –

Here we had only selected contact table for sync initially, and it had around 2.5 million records.

To fix this, we unlinked (using Unlink Option) and created the link again and this time we selected a table having very few record for e.g. country table as shown below.

This time the sync started immediately.

Than through Manage tables option, we added our contact table also, and it also started syncing properly as shown below-

Hope it helps..


Solved – Disabled Turn on unified routing option in Dynamics 365 Customer Service Hub

Recently while trying to provision Unified Routing from Dynamics 365 Customer Service Hub in one of our trial environments (Service Management >> Service Configuration >> Unified Routing – Turn on unified routing.),

even after providing the consent multiple times (by clicking on Provide consent, with Global Admin role)

it kept coming as disabled and kept asking for providing the consent.

Opening in in-private browsing or a different browser didn’t fix it.

Clearing the cache also didn’t help – Empty Cache and Hard Reload

The trick that worked here was creating a workstream record

which also triggered the provision of Unified Routing 

And after our workstream record got created,

we could see the unified routing enabled successfully.

Hope it helps..


Sample code to retrieve more than 5000 records using FetchXML in CRM


Sharing a sample code to retrieve more than 5000 records using the Fetch XML.

Version 1 :

private List<Entity> GetTotalRecordsfromFetch(string fetchXML, IOrganizationService orgService)
List<Entity> lstEntity = new List<Entity>();

int fetchCount = 5000;
int pageNumber = 1;
string pagingCookie = null;

while (true)
// Build fetchXml string with the placeholders.
string xml = this.CreateXml(fetchXML, pagingCookie, pageNumber, fetchCount);
RetrieveMultipleRequest fetchRequest = new RetrieveMultipleRequest
Query = new FetchExpression(xml)

var returnCollections = ((RetrieveMultipleResponse)orgService.Execute(fetchRequest)).EntityCollection;

if (returnCollections.Entities.Count >= 1)

if (returnCollections.MoreRecords)

results.pagingCookie = returnCollections.PagingCookie;
// If no more records in the result nodes, exit the loop.

return lstEntity;

public string CreateXml(string xml, string cookie, int page, int count)
StringReader stringReader = new StringReader(xml);
XmlTextReader reader = new XmlTextReader(stringReader);

XmlDocument doc = new XmlDocument();

XmlAttributeCollection attrs = doc.DocumentElement.Attributes;

if (cookie != null)
XmlAttribute pagingAttr = doc.CreateAttribute("paging-cookie");
pagingAttr.Value = cookie;

XmlAttribute pageAttr = doc.CreateAttribute("page");
pageAttr.Value = System.Convert.ToString(page);

XmlAttribute countAttr = doc.CreateAttribute("count");
countAttr.Value = System.Convert.ToString(count);

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

XmlTextWriter writer = new XmlTextWriter(stringWriter);

return sb.ToString();

Version 2 –

private static List<Entity> GetTotalRecordsFetchXML(OrganizationServiceProxy orgProxy, string fetchXML)
XDocument xDocument = XDocument.Parse(fetchXML);
var fetchXmlEntity = xDocument.Root.Element("entity").ToString();

EntityCollection entityColl = new EntityCollection();
List<Entity> lstEntity = new List<Entity>();
int page = 1;

entityColl = orgProxy.RetrieveMultiple(new FetchExpression(
string.Format("<fetch version='1.0' page='{1}' paging-cookie='{0}'>" + fetchXmlEntity + "</fetch>",
SecurityElement.Escape(entityColl.PagingCookie), page++)));

while (entityColl.MoreRecords);

return lstEntity;

Hope it helps..


System.Security.SecurityException: That assembly does not allow partially trusted callers while using HttpUtility.UrlEncode in CRM


We got the below error in one of our Sandboxed Plugins

“System.Security.SecurityException: That assembly does not allow partially trusted callers”.

We realised it was because of using System.Web.HttpUtility class

We replaced it with EscapeDataString method and this fixed the issue.


Helpful thread

Hope it helps..

How to – Use WebClient to call external service from CRM Online Sandboxed Plugin (HTTP POST and JSON)

Sharing a sample code that can be used to send JSON data using POST to an external service inside CRM Online Plugin. As plugin runs in sandbox mode we cannot reference Newtonsoft’s JSON.NET library The other option could be to use ILMerge, which isn’t that elegant.

Here, basically we are passing some information related to lead to an external service on Post Create of it.

<p>using Microsoft.Xrm.Sdk;<br />
using System;<br />
using System.IO;<br />
using System.Net;<br />
using System.Runtime.Serialization.Json;<br />
using System.Text;</p>
<p>namespace MyTestPlugin<br />
<p> public class Lead<br />
 {<br />
 public string Topic { get; set; }<br />
 public string FullName { get; set; }<br />
 public string Email { get; set; }<br />
<p> public class MyPluginClass : IPlugin<br />
 {<br />
 public void Execute(IServiceProvider serviceProvider)<br />
 {<br />
 try<br />
 {<br />
 // Obtain the execution context from the service provider.<br />
 IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));</p>
<p> // The InputParameters collection contains all the data passed in the message request.<br />
 if (context.InputParameters.Contains("Target") &amp;&amp; context.InputParameters["Target"] is Entity)<br />
 {<br />
 // Obtain the target entity from the input parameters.<br />
 Entity entity = (Entity)context.InputParameters["Target"];</p>
<p> using (WebClient client = new WebClient())<br />
 {<br />
 var myLead = new Lead();<br />
 myLead.Topic = entity.Attributes["subject"].ToString();<br />
 myLead.FullName = entity.Attributes["fullname"].ToString();<br />
 myLead.Email = entity.Attributes["emailaddress1"].ToString();</p>
<p> DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(Lead));<br />
 MemoryStream memoryStream = new MemoryStream();<br />
 serializer.WriteObject(memoryStream, myLead);<br />
 var jsonObject = Encoding.Default.GetString(memoryStream.ToArray());</p>
<p> var webClient = new WebClient();<br />
 webClient.Headers[HttpRequestHeader.ContentType] = "application/json";<br />
 var code = "key";<br />
 var serviceUrl = "" + code;</p>
<p> // upload the data using Post mehtod<br />
 string response = webClient.UploadString(serviceUrl, jsonObject);<br />
 }<br />
 }<br />
 }<br />
 catch (Exception ex)<br />
 {<br />
 throw new InvalidPluginExecutionException(ex.Message);<br />
 }<br />
 }<br />
 }<br />
}<br />

Hope it helps..


Using MediaWiki API for Showing content of Wikipedia page inside Dynamics 365 form


Recently we had a requirement to show content of Wikipedia page and display it inside CRM in one of the entities form.

For this purpose, we can make use of “MediaWiki web service API.”

To create the query, we can use the below tool

The html source code

<!DOCTYPE html>
<html xmlns="">
<script src=""></script>
<script type="text/javascript">

function SetWikiContent() {

// get country name from crm form
if (Xrm.Page.getAttribute("new_name") != null) {

var title = Xrm.Page.getAttribute("new_name").getValue();

// set the url
var url = "" + title + "&prop=text&section=0&callback=?";

$.getJSON(url, function (data) {
for (text in data.parse.text) {
var text = data.parse.text[text].split("
var pText = "";

for (p in text) {
//Remove html comment
text[p] = text[p].split("<!--");
if (text[p].length > 1) {
text[p][0] = text[p][0].split(/\r\n|\r|\n/);
text[p][0] = text[p][0][0];
text[p][0] += "
text[p] = text[p][0];

//Construct a string from paragraphs
if (text[p].indexOf("
") == text[p].length - 5) {
var htmlStrip = text[p].replace(/<(?:.|\n)*?>/gm, '') //Remove HTML
var splitNewline = htmlStrip.split(/\r\n|\r|\n/); //Split on newlines
for (newline in splitNewline) {
if (splitNewline[newline].substring(0, 11) != "Cite error:") {
pText += splitNewline[newline];
pText += "\n";
pText = pText.substring(0, pText.length - 2); //Remove extra newline
pText = pText.replace(/\[\d+\]/g, ""); //Remove reference tags (e.x. [1], [4], etc)


<body onload="SetWikiContent();">

The helpful article

Hope it helps..

%d bloggers like this: