Open create ‘Form’ from sub-grid directly by avoiding associated records between entities

In MSD 365, when we add sub-grid on form by creating relation between two entities, it will gives Create (+) button and associate view button. When we click on Create (+) button, dynamics shows already created associations between these two entities, ref below screen shots…

Association

Some time we don’t require this associated records and always want to create new record by avoiding all those clicks. We can achieve it by making relation mandetory, just as shown in below image.

make it relation required

…and you are done, now go back to the subgrid and click on the ‘Create’ (+) button, it will launch new create window and won’t ask to select existing association.

Thanks.

bulk Create/Update/Delete for Dynamics 365

 Secret

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 http://msdn.microsoft.com/en-us/library/jj863631.aspx

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

Many times we need to send and or receive parameters from plugin to JavaScript and vice a versa. So here are the steps for it…

  • Create an action with input & output entity reference parameters. Make sure all parameters are required.
  • In your JS code
    • function CreateWID(firstEntiryGuid, secondEntityGuid) {

 

    •     var data = {
    •         “FirstInput”:
    •             {
    •                 “@odata.type”: “Microsoft.Dynamics.CRM.itlec_firstEntiry”,
    •                 “itlec_firstEntiryid”: firstEntiryGuid,
    •                 // no need to put name and logical name.
    •             },
    •         “Secondnput”:
    •             {
    •                 “@odata.type”: “Microsoft.Dynamics.CRM.itlec_SecondEntity”,
    •                 “itlec_SecondEntityid”: secondEntityGuid,
    •                 // no need to put name and logical name.
    •             }
    •     };
    • //to call Async
    •     ITLecXrmUtilsAction.CallGlobalActionAsync(“itlec_entitydata”, data, “WIDRecordCreated”);
    • ///to cal Synchronous
    • var result  = ITLecXrmUtilsAction.CallGlobalAction(“itlec_entitydata”, data);
    • var recGuid  = result.itlec_entitydata;
    • }
  • Done

Continue reading “Call action with input & output parameters”

Setting up a visual hierarchy on a custom entity

hier-main

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”

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
http://www.microsoft.com/en-us/download/details.aspx?id=17630

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

Example:

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:

ILMergeConfig.json

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

{
	"General": {
		"InputAssemblies": [
		  "$(SolutionDir)libs\\XrmUtils.Plugins.Abstractions.dll", 
		  "$(SolutionDir)libs\\XrmUtils.Plugins.Utilitiesd.dll" 
		]
	}
}

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

{
	"General": {
		"InputAssemblies": [
		  "XrmUtils.Plugins.Abstractions.dll", 
		  "XrmUtils.Plugins.Utilities.dll" 
		]
	}
}

See Configuration File complete reference.

That’s it for now.

Thanks!

Few more ref

  1. http://develop1.net/public/post/2018/10/21/ILMergeNotSupported
  2. https://medium.com/capgemini-dynamics-365-team/using-gov-uk-notify-in-a-dynamics-crm-plugin-without-ilmerge-cf89f372cd5d 

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

Enable / disable Dev error message

Sometimes we don’t understand what the hell is going on behind the scene while working with Dynamics CRM. As error messages are in friendly manner, eg below

So, in such time it’s better to get the detailed message that will direct to correct the problem.

For such, senario we can enable descriptive/developer error with unsupported way. Login to CRM server and open ‘web.config’ and set developer errors to ‘On’ instead of off as shown below,

<add key=”DevError” value=”On”/> from <add key=”DevError” value=”Off”/>.

It will show you descriptive error message like below

But for the end user it’s disaster, he thinks that application has been broken and raises the critical bug. So just reverse, everything will be alright.

Thanks!!

Query hierarchical data

Retiring hierarchical data is easy, we don’t need to iterate by for/while loop. just use ‘Above’ or ‘Under’ keywords, then it will serve you all parents or all child available.

in regular query, just ‘ConditionOperator.Above’ to get all parents.

in regular query, just ‘ConditionOperator.Under’ to get all child.

How to create this type of structure

Continue reading “Query hierarchical data”

Configure and visualise hierarchical data

In MS Dynamics CRM, Self join has special powers, with self join we can create hierarchical data structure, as shown below,

hirarchy Continue reading “Configure and visualise hierarchical data”

A Firefox Add On for MS CRM Users

Firefox have Add-in which is very helpful for MS CRM developers,  Just like Crom extension helps MS CRM developers. 

The CRM Power Pane is a helper tool designed to integrate with Microsoft Dynamics CRM application and allow you to manipulate forms or perform actions faster throughout the Microsoft Dynamics CRM application .

It has following features

power pane for ex. you want to know the schema name of attribute, just click on ‘Schema name copy mode’ and then click on desired attribute, on mouse over it will show that name and on click that name will be copied on clipboard, as shown below..

power pane ex

also, if you want current record ID, just click on that option, id will be pop out. same like that you will get many other information without going in to the customisation mode with admin rights.

 

As well as you can unlock locked fields and put info there for testing purpose and save the form without making any customisation.

…. and many more.

To install it, go to Firefox add-ins and search for ‘Dynamis crm power pane’, then just install it …. and save your time ….

firefox power pane

 

Thanks you. !!