Refresh Sub-Grid based on field value

Sometimes we need to refresh (or load data) MSD 365 sub-grid data based on some condition. This can be done with small JS, here is the sample code, its applicable to the editable grid as well….

But make sure that

  • The grid you are configuring is not set to ‘Related Records only’
  • You are configuring same entity which you querying in the query

ed grid

Here is the code ….

function FilterSubgridBasedOnField() {
var sGrid = window.parent.document.getElementById("Your_Grid_Name");
if (sGrid == null) {
alert("Grid is null");
setTimeout(function () { FilterSubgridBasedOnField(); }, 2000);
var fetchXml = [ "Your Fetch XML Query" ].join("");
if (sGrid.control != null) {
sGrid.control.SetParameter("fetchXml", fetchXml);
alert("Sub-Grid has updated with new data.");
else {
setTimeout(FilterSubgridBasedOnField, 500);

Thanks !!

Document creation in MSD 365

Many times we need to create document in MSD CRM and or MSD 365, ex. Quote. In earlier CRM version it was not available out of the box. But as part of MSD CRM 2016 and MSD 365 its has been introduced out of the box, in few clicks we cam create document or automate the process with the help of out of box workflow.  Continue reading “Document creation in MSD 365”

bulk Create/Update/Delete for Dynamics 365


Create / Update / Delete can be done with bulk operation, to avoid more DB hits and it will improve performance of the plugins and or code.

Here is reference MSDN URL

Default max batch size is 1000, its applicable for all three create/update/delete.

  1. bulk Create can be done with following code snippet
CreateRequest createRequest = new CreateRequest { Target = 'your Entity Object' };

2. bulk Update can be done with following code snippet

UpdateRequest updateRequest = new UpdateRequest { Target = 'your Entity Object' };

3. bulk Delete can be done with following code snippet

DeleteRequest deleteRequest = new DeleteRequest { Target = 'your Entity Reference Object' };

Here are sample code blocks for bulk Update


Create multiple execute request

/// <summary>
 /// Create an ExecuteMultipleRequest object
 /// </summary>
 /// <returns></returns>
 private static ExecuteMultipleRequest CreateBulkExcuteRequest()
 var multipleRequest = 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()
 return multipleRequest;

Continue reading “bulk Create/Update/Delete for Dynamics 365”

Call action with input & output parameters

Continue reading “Call action with input & output parameters”

Setting up a visual hierarchy on a custom entity


Hierarchy visualisation can be configured in MSD 365, its pretty easy. Here are the steps for it. Continue reading “Setting up a visual hierarchy on a custom entity”

FetchXML Query with NOT-IN

Tips &amp; Trics

If you want to get all available Resources of specific Resource Category that don’t have any booking for the particular period with FetchXML,  I tried NOT-IN clause and landed in following error,

Microsoft.Crm.CrmException: Unknown Condition Operator: not- in
at Microsoft.Crm.Platform.QuerySerializationUtil.ConditionOperatorFromString(String operatorText)

But OUTER join worked for the scenario and it gave the correct result. With small change it will give the result of get all Accounts who does not have Active Contacts or Opportunity does not have tasks in a specific time period.

Here is the code snippet for it

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
 <entity name="bookableresource">
 <attribute name="name" />
 <attribute name="bookableresourceid" />
 <order attribute="name" descending="false" />
 <filter type="and">
 <condition attribute="statecode" operator="eq" value="0" />
 <link-entity name="bookableresourcebooking" from="resource" to="bookableresourceid" link-type="outer" alias="bx">
 <filter type="and">
 <condition attribute="starttime" operator="on-or-after" value="2018-03-01" />
 <condition attribute="endtime" operator="on-or-before" value="2018-03-31" />
 <link-entity name="bookableresourcecategoryassn" from="resource" to="bookableresourceid" link-type="inner" alias="by">
 <filter type="and">
 <condition attribute="resourcecategory" operator="eq" uiname="Backhoe" uitype="bookableresourcecategory" value="{798E6C02-3BBE-E711-8123-E0071B686A81}" />

That’s it!

Thank You! 🙂

Web API and plural names


JavaScript Plural name issue almost killed us, following post saved us. 🙂 …. CRM 2016 Web API and plural names … Thanks for the post nice post. I’m re-posting the article ..

The new Web API available for CRM 2016 is based on OData V4 protocol and the endpoint is /api/data/v8.0/

Continue reading “Web API and plural names”

Configure the schedule board for resource availability

Resource Scheduling1
Get the correct resource

The Dynamics 365 for Field Service schedule board provides an overview of resource availability and bookings you can make. Before you use the schedule board, it is important to set up the views and filters to your preference.

Applicable to Dynamics 365 (online) ==> Field Service, version 9.x


To use the schedule board booking functionality, geocoding, and location services, you need to turn on maps.

  1. From the main menu, click Resource Scheduling > Administration.
  2. Click Scheduling parameters.
  3. Open the record and scroll down to the Resource Scheduling Optimization section.
  4. On the Connect to Maps field, choose Yes.
  5. Accept the terms and save the record.

Continue reading “Configure the schedule board for resource availability”

Schedule anything with Universal Resource Scheduling

This slideshow requires JavaScript.

Schedule anything in Dynamics 365 using Universal Resource Scheduling. You can enable scheduling for any entity including custom entities.

For example, you can enable scheduling for the opportunity form and schedule marketing visits for your opportunities. You can also do this for the case form and schedule time to work on cases.

This is applicable for Sales, Customer Service, Field Service, Project Service Automation Continue reading “Schedule anything with Universal Resource Scheduling”

DLL merge and MSD CRM/365 (on-prem/On-Line)

Tips &amp; Trics

While working as a developer, many times we will have some readymade tools or class libraries / DLLs, which were developed by some other developers and they publish for developer kind. Salute to their generosity.

We use those libraries in our development and our life becomes little easier. But while deploying it on other environments we have to install those things and or keep those DLLs on another environment, if we miss it then because of those open libraries, development breaks.


So in such conditions, we can merge multiple DLLs in one to make our life bit easier.

If it’s exe, user following function to make one DDL.

Advantage: it will keep the original identity of the DDL.

Disadvantage: it won’t work for the library building. For e.g. CRM plugins

Here is that great function …

private static void AsseblyResolveEvent()
 AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
 String resourceName = "AssemblyLoadingAndReflection." +
 new AssemblyName(args.Name).Name + ".dll";
 using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
 Byte[] assemblyData = new Byte[stream.Length];
 stream.Read(assemblyData, 0, assemblyData.Length);
 return Assembly.Load(assemblyData);

Curtsy: This function has written by Jeffrey Richter, here is his article for it.

If it’s DDL and or class libraries, ILMerge will useful.

Advantages: it’s free and lite installation. Easy to use.

Disadvantage: After merging DDLs with ILMerge, DDL will lose its identity, that’s why we can not use for CRM plugin libraries. While writing commands we need to bit careful else spelling mistake might frustrate you. 😉

You need to install it after download from here. Then by following commands, you can merge multiple DDLs together.

Steps: Once its installed, open command window with admin rights and execute it, follow the commands

Step 1: Download ILMerge utility and install it in your machine

Step 2: Compile and Publish your Project to a folder (eg: C:\Publish\)

Step 3: Use the ilmerge command to merge the exe and dll files and output single exe file

ILMerge Command

Syntax (Simple*): ilmerge <input assembly 1> <input assembly 2> /out:<output file> /target:<dll|exe|winexe>

*For the complete set of options and syntax refer ILMerge Documentation


C:\Program Files\Microsoft\ILMerge>ilmerge C:\Publish\MyProgram.exe C:\Publish\MyLibrary.dll /out:C:\Publish\MyWinApp.exe /target:winexe /ndebug

ilmerge – Command

MyProgram.exe – Output from the published folder

MyLibrary.dll – Any library used in the program

/target:winexe – We need to output a single exe file for Windows Platform

/output – Output folder and filename

/ndebug – To disable debug (.pdb file)

Curtsy: Arun Ramchandran’s blog , for more info, explore this link and this link.

Above both options won’t be useful for MSD CRM or MSD 365. 😔

So, to make those libraries useful for these environments we have to create a folder in your plugin project so it will be part of plugin project. And we don’t need to merge it anymore. 😉

Thus, we have two options available for it,

If those libraries are open source then we will get everything available online(thanks to generous great developers), just get only those classes which useful for you and ignore the rest of classes from that DDL.

But if it’s not open source then we need bit more efforts. As we need to use ILSpy or some similar add-on to decompile that code and then use in our plugin or workflow library.

There is another way for same is merging these files together along with its signature. Here are the details for it. (Courtesy: github )

Use Nuget to add ILMerge.MSBuild.Task to your Visual Studio project:

Install-Package ILMerge.MSBuild.Task

Also, install the ILMerge Package:

Install-Package ilmerge

Build your project. The merged assembly will be stored in an ILMerge folder under the project output.

Merge Assemblies With Copy Local = True

By default, all references with Copy Local equals true are merged with your project output.

Creating a Static List of Assemblies to Merge

It is also possible to use a static list of assemblies instead of inspecting the Copy Local property. This can be done through a configuration file added to the root of your project. Create a JSON file and name it as follows:


The following snippet uses the InputAssemblies property to specify the files to be merged into the project output.

	"General": {
		"InputAssemblies": [

You don’t have to specify a path if assemblies are expected to be in the target directory:

	"General": {
		"InputAssemblies": [

See Configuration File complete reference.

That’s it for now.


Few more ref


Continue reading “DLL merge and MSD CRM/365 (on-prem/On-Line)”