Category: Uncategorized

Plugin on Retrieve Multiple in CRM.

Filtering records using javascript in subgrid or a view is unsupported and doesnt work hence here is how you can/should filter subgrid records using a plugin.

Nishant Rana's Weblog

Recently we had a requirement to filter sub grid on one of the forms. We thought of using Plugin on Retrieve Multiple for this.

Here we were showing Opportunity Sub Grid on Account form.

So we created a view for Opportunity that will be used as Sub Grid. Used it as Related Record Sub Grid so that we can have the GUID of the Account record being passed to the plugin.

The problem we faced à Sorting and Paging stopped working for the Sub Grid.

Hope it helps..

View original post

Quick Fix : Mandatory Field Error Shows Schema Name Instead Of Display Name

Quick blog on how to fix the error you get when you save a record which has some required fields on the header of the form and CRM shows the schema name instead of display name like below:


it shows the error which includes specific field logical name instead of display name which might be confusing for user and doesn’t look very much user friendly. In my case its still very much understandable but sometimes people change name on the form and in that case it will be worse situation.


All you have to do is put the same field on the form which is there on the header and hide it on the form. Open the form editor > select the section > look for the field and add it. Go to field properties and hide it by unchecking the visible by default box:


Save and publish all your changes and now try to save the record:


I hope this help!

Handle Boolean/Two Option Fields In Scribe Data Migration/Bulk Update

I know many CRM developer get into Data migration or bulk update operation from CRM system to other external/CRM system.

I have gathered few useful tips while dealing with boolean fields as in how to check the value , reverse the value , use nested if with OR & AND conditions etc. I have categorised them into below and provided explanation & solution.

  1. Check Values from Source & Set New Value 

    To check value of a boolean field from source do this and set other value:

    IF(S1=1, 0 , 1)

    (Here i am checking if S1 field value is “1” which is “TRUE” then set the new value to “0” which is “FALSE” otherwise the default will be to “1”.)

  2. Check Combination of boolean fields and Set New Value

    To check the combination of values i.e If a=1, b=0 then set some new value, Do this:

    IF(AND(S1=1, S2=1), 0 , IF(AND(S1=0, S2=0),1 ))

    (here i am checking if S1=1 AND S2=1 then outcome should be “0”.
    please note: you can use “OR” operator as well as per your requirement.)

  3. Check If the value is Null or Any error in retrieving the value and set default value

    You might have to handle null values in the package, to do this:


    (here I am checking if S1 is null or any error then i am setting the value to TRUE otherwise FALSE.)

    you can also combine this with checking other values to such as if S1 =1 then 1 , S2=0 then 0 & if S2=Null then TRUE().

    IF(ISERROR(S1),TRUE(),IF(OR(S1 =1 ), 0,IF(OR(S1=0),1)))

    I hope this helps! I will try post help blog on other types of fields.

Solution Import Error 0x80044150 – Object reference not set to an instance of an object.


While importing a solution I got a generic SQL error but when i downloaded the log file i saw below error:

import error1

0x80044150 – Object reference not set to an instance of an object 

I have seen this error in plugins several times but never in import but root cause and underlying issue remains the same.

The import was trying to find something which was not there in target.


There was a relationship in my solution exist as N:1 to an entity which was deleted from target system way back hence this error occurred. Using the relationship given in solution, CRM was trying to find related entity which wasn’t there.


Hope this helps.

Error While Connecting To CRM Online Using Kingsway SSIS Connector


I have recently got this error when i was preparing an SSIS package for Dynamics CRM 365 Online and used Kingsway SSIS connector.



After digging in further this error is mainly caused by the request and reponse timings,So, when i checked i found out my system time was somehow 5 minutes ahead of the current time, hence the request going to CRM server was of a future time and hence this error showed up.

All i had to do is fix my system time. Sometimes even if your system time is fine, you might still get the error, In that scenario too try to change the time as 5 minutes less.


Once i did that -my organisation name popped up without any issue.


Hope this helps!



Show Lost and Won Opportunities In A Chart By User/Owner

Just a quick blog on a question asked in dynamics community here :

Requirement was to show Lost & Won opportunities grouped by a manager in a Bar Chart:

Try below Steps.

  1. Create a view as below :chart3
  2. Create a chart on that view in opportunity as below:chart
  3.  Save and close & make sure to publish the customisation. Below is the end product.


Hope this helps!




An unsecured or incorrectly secured fault was received from the other party

Issue :

Recently i have encountered this error when i was trying to connect to Dynamics CRM 365 online.



I digged in further and found a post where couple of suggestions were mentioned :

Solution : It was to do with my system settings(Time) – my system time was ahead of the server time. which means the request was going to server with a future time. 

hence i have changed the time in my system clock to be 5 minutes less. Which indeed worked.


I hope this helps!

Simplified Connection To Dynamics CRM 2016 Onpremise Using Console Application

Here is the quick code that i use when i have to build a console application that connects to dynamics crm onpremise version with AD/IFD Authentication.

Main Class:

ClientCredentials _clientCreds = new ClientCredentials();
_clientCreds.Windows.ClientCredential.UserName = ConfigurationManager.AppSettings["username"];
_clientCreds.Windows.ClientCredential.Password = ConfigurationManager.AppSettings["password"];
_clientCreds.Windows.ClientCredential.Domain = ConfigurationManager.AppSettings["domain"];
var organizationUri = ConfigurationManager.AppSettings["CRMUrl"];

_service = (IOrganizationService)new OrganizationServiceProxy(new Uri(organizationUri), null, _clientCreds, null);

OrganizationServiceContext _orgContext = new OrganizationServiceContext(_service);


<?xml version="1.0" encoding="utf-8"?>
<section name="AppSettings" type="System.Configuration.AppSettingsSection, System.Configuration, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" restartOnExternalChanges="false" requirePermission="false" />
<add key="CRMUrl" value="" />
<add key="Username" value="rawishkumar" />
<add key="Password" value="password" />
<add key="Domain" value ="exampledomain"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>


Required Assemblies:

using System.ServiceModel.Description;

using System.Configuration;

using Microsoft.Xrm.Sdk;

using Microsoft.Xrm.Sdk.Client;

Hope this helps!

SQL Connection to CRM Database

Dynamics CRM has very efficient web services using which you can retrieve data such as Organization service Or WebApi. However if you still need to retrieve data from database here is a quick code helper – which i am using in a console application.

//Initiate the connection
using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings["SQLServerConnection"].ConnectionString))
//create a command variable
using (var command = connection.CreateCommand())
//add query to your command
command.CommandText = "your SQLquery goes here";

// open the connection first and then execute the query using Execute Reader
result = command.ExecuteReader();

here is the app.config which i have used , i am using the windows authentication hence you donot need to mention credentials.

<?xml version="1.0" encoding="utf-8"?>
<add name="SQLServerConnection" connectionString="Server=.;;Trusted_Connection=True;"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>

By Now you will have your dataset in “result”; here is another piece of code to read the data:

 if (result.HasRows)
 while (result.Read())
string contactid= result["columnName"].ToString();
string contact = result["columnName"].ToString();
DateTime createdonDate= (DateTime)result["createdon"];
string type = result["columnName"].ToString();

// close the result
 if (result != null)


I hope this helps!