About myself


Currently working as Senior Programmer/Analyst – CRM for Sandisk.

I have got 10 years of  experience in Microsoft .NET Technologies with close to 7 years of dedicated experience in Microsoft Dynamics CRM. Prior to SanDisk, I have worked with companies like Microsoft, PwC, TMF Group and have extensive experience of implementing complex CRM solutions from both offshore and client side.

I have been involved with challenging projects and environments which have helped me in developing excellent analytic and problem solving skills. A significant part of my work history has involved acting in the capacity of expert,developer and consultant specializing in finding solutions for clients with their day to day software they are using to run their business.

I have experience in Consulting, Development and Trainings

My codeplex contributions:

  1. Role based views in Dynamics CRM
  2. FetchXml To SQL Converter
  3. Personal View editor in Dynamics CRM
  4. Access Team Template Migrator for Dynamics CRM
  5. Visual studio intellisense for Dynamics CRM
  6. Field Level Security Configurator for Security
  7. Client API for Event driven Business Process Flow for Dynamics CRM 2013
  8. Error Logger for Microsoft Dynamics CRM

Specialties: MS Dynamics CRM: CRM2011, CRM 2013, CRM 2015, CRM 2016, Azure, jQuery, Knockout.js, TypeScript, ADX Studio

As much I wish to share my knowledge through my blogs and tools, I crave more to learn from the community. Stay connected.

To know more about me, please visit my linked in profile : in.linkedin.com/in/debajdu/

For consulting & training, please visit my website www.xrmforyou.com or email me at info@xrmforyou.com

21 thoughts on “About myself

  1. kundan

    I am Trying to Get the All Organisations Url Usin Web Api,But I M Not Getting Any Output ,Can u please Give me Some Idea about how to Get it..I Am Sending you my code snnipet
    function WhoAmIRequest() {

    //var clientUrl = “https://disco.crm5.dynamics.com”;
    var req = new XMLHttpRequest();
    req.open(“GET”, “https://disco.crm5.dynamics.com/api/discovery/v8.0/Instances”);

    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 /* complete */) {

    req.onreadystatechange = null;

    if (this.status == 200) {

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

    alert(“User Id : “+discovery.Url);


    else {

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






    1. Debajit Post author

      Hi Kundan,
      Thanks for reading my blog!
      Could you please let me know from where you are firing this query? I can have a look then to replicate the same scenario as there are some limitations when you fire the web api discovery api query from within the context of your organization.


      1. kundan

        Hi Debajit,
        Thanks for reply..

        I Have created a java script web resource that i have placed in Lead’s Form Properties, and firing it in the On Save(event) of Lead..

  2. Ben Salins

    Hello Deb,

    Thanks for the lovely blogs, they are definitely their weight in gold.
    I had a question on the developer toolkit that you use.

    After CRM 2013, MS hasn’t released any Developer toolkit for 2015 and 2016.
    This definitely has created problems for me working on CRM 2015 with Visual Studio 2015.

    There are blogs which have suggested using hacks for VS 2013 ( though i’am not too comfortable using it).

    I’am just curious how do you manage to use Developer Toolkits for CRM 2015 and 2016.
    It would really be helpful, if you could suggest a thing or two.



    1. Debajit Post author

      Hi Ben,
      Feels great that you liked my posts.

      Yes I know its frustration that Microsoft has not released developer toolkit compatible with vs2013/ vs2015. Even I do not prefer the vs2013 hack.

      However from the community as far I know, Microsoft is in the process of release developer toolkit with vs 2015. It would work for vs2013 as well. It is in beta state though.

      Sit tight. It should be released soon 🙂

  3. Kundan

    Hi Debajit,

    Same Scenario I am trying using plugin (create contact Record form one organisation to another organization), It is working fine in our in-house CRM (version-crm 2013) but when i am trying same to do it in client server (crm-2015) it is thtorwing error in certificate permission(Line OrganisationServiceProxy Creation)
    The error is :- Request for the permission of type ‘System.Security.Permissions.SecurityPermission, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed.

    Can u please check once for any solution for this..

    The Code which i Am using:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Microsoft.Xrm.Sdk;
    using Microsoft.Xrm.Sdk.Query;
    using Microsoft.Xrm.Sdk.Client;
    using Microsoft.Xrm.Sdk.Discovery;

    using System.ServiceModel.Description;
    using System.Security;
    using Microsoft.Crm.Sdk.Messages;
    using System.Text.RegularExpressions;
    using System.Net;
    using System.Net.Security;
    using System.Security.Cryptography.X509Certificates;

    namespace Synchronise_Plugin
    [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = “FullTrust”)]

    public class Class1 : IPlugin
    string newfirstname, newlastname;
    //static IOrganizationService service;
    static IOrganizationService service1;
    private static bool AcceptAllCertificatePolicy(Object sender, X509Certificate certificate, X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors)
    return true;

    public void Execute(IServiceProvider serviceProvider)
    IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
    IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));

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

    Entity entity = (Entity)context.InputParameters[“Target”];
    string createdentityname = entity.LogicalName;

    Guid createdid = entity.Id;

    ClientCredentials credentials = new ClientCredentials();
    //credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
    credentials.UserName.UserName = @”XYZSERVER\Administrator”;
    credentials.UserName.Password = “XYZ@123”;
    Uri OrganizationUri = new Uri(“https://XYZ.XYZit.com:444/XRMServices/2011/Organization.svc”);
    Uri HomeRealmUri = null;
    OrganizationServiceProxy serviceProxy = new OrganizationServiceProxy(OrganizationUri, HomeRealmUri, credentials, null);
    service1 = (IOrganizationService)serviceProxy;

    ServicePointManager.ServerCertificateValidationCallback = AcceptAllCertificatePolicy;

    ColumnSet col = new ColumnSet(true);
    Entity createdobj = service.Retrieve(createdentityname, createdid, col);

    newfirstname = createdobj.Attributes[“firstname”].ToString();
    if (createdobj.Contains(“lastname”))
    newlastname = createdobj.Attributes[“lastname”].ToString();

    Entity Contact = new Entity();
    Contact.LogicalName = “contact”;
    Contact.Attributes.Add(“firstname”, newfirstname);
    Contact.Attributes.Add(“lastname”, newlastname);
    // Contact.Attributes.Add(“description”, orgname.ToString());


    1. Debajit Post author

      Hi Kundan,

      First of all, running a plugin in CRM server with full trust is not suggested and more than often it would fail while gaining the full trust. even if it works now, if security policies change, it would fail in the future.

      Coming back the requirement. You want sync contact records between two CRM organizations. If that is the case you should delegate this to some scheduled job. This is how you approach the solution.

      1. Create a new field in the contact entity called ‘Sync Complete’. It should be two options (Yes/ No). By default No. You can name it anyway you like
      2. Create a console application (.exe) that would connect to your target environment.
      3. The console app should be scheduled to run at every 30 mins say in the windows task scheduler of the CRM server.
      4. The logic in the console should be to check for any contact records which ‘Sync Complete’ = No. If there is is, it will create the contact in the target environment and update the contact in the source environment to ‘Yes’. this will prevent the contact to get processed again in the next run of the job.

      1. Kundan Agrawal

        Hi Debajit,
        Thanks for the new Approach to complete this requirement,
        actually now this Plugin is working correctly,it is creating contact to another organisation correctly ,before it was plugin assembly problem in plugin registration tool, i had registered same plugin assembly to both the organisation..

  4. Santhi Kumari

    Hi Debajit,

    Do you have any sample code that calls CRM Stored Procedure through Plugin? CRM organizations stored procedure is not supported way but we can still create SP under CRM org database and invoke through plugin right?

    1. Debajit Post author

      Hi Santhi,
      I wonder why would you want to do this considering the fact you know its strictly unsupported.

      For the code, SQL connection code with SSPI authentication is the only option. The code would be similar to the way you connect to a stored procedure using ADO.NET. You would find numerous samples in google for that.

  5. Kundan

    Hi Debajit,

    I wonder to get all the entities in html page,,can u give me any suggestion how to get all entities in html web resource if it is possible..
    Actually my requirement is to fetch all entity list in solution Configuration Page so if You Please help me to complete that scenario then it will be very helpful for me..

  6. Kundan

    Hi Debjit,
    As I am trying to execute web Api calls to CRM, it is showing the error on authContext.AcquireTokenByAuthorizationCode,
    Can you please suggest me any idea what is the actual reason behind this error.

    I have added the using Microsoft.IdentityModel.Clients.ActiveDirectory package.

    Error 2 ‘Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext’ does not contain a definition for ‘AcquireTokenByAuthorizationCode’ and no extension method ‘AcquireTokenByAuthorizationCode’ accepting a first argument of type ‘Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext’ could be found (are you missing a using directive or an assembly reference?) C:\Users\kundan.a\Documents\Visual Studio 2012\WebSites\WebSite6\Default.aspx.cs 39 59 WebSite6

  7. Kundan

    Hi Debjit,

    As i have integrated Sharepoint with dynamics 365 onpremise,Is there any possiblility or similar way to upload document in Sharepoint from CRM by Drag and Drop feature?

  8. Vivek

    Hi Debajit,
    I am trying to create a folder in sharepoint online using CSOM. I have written the code to create the folder in the plugin code. But When I am trying to run that plugin through creation of some records in Dynamics 365 online instance it is showing the below error:
    Request for the permission of type ‘System.Security.Permissions.SecurityPermission, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed.

    1. Debajit Post author

      Hi Vivek, CRM online plugins run in sandbox mode. You cannot use the CSOM for online. The only way to make it from crm online is to use the Sharepoint rest endpoint

      1. Vivek

        Thank You Debajit.
        I have written a code using rest endpoint but it is showing the 403:Forbidden error.
        Code is given below:

        string webSPOUrl = “https://ema01.sharepoint.com/sites/doc_upload”;
        string userName; string passsword;//I have assigned them in the original code.
        SecureString password = ToSecureString(passsword);
        string request_digest = GetFormDigest(webSPOUrl, userName, password);
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(@”https://ema01.sharepoint.com/sites/doc_upload/_api/web/folders”);
        request.UserAgent = “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36”;
        request.Headers.Add(“X-RequestDigest”, request_digest);
        // Set the Method property of the request to POST.
        request.AutomaticDecompression = DecompressionMethods.GZip;
        request.Method = “POST”;
        // Create POST data and convert it to a byte array.
        string postData = “{‘_metadata’:{‘type’: ‘SP.Folder’},’ServerRelativeUrl’: ‘Contact/Sample’}”;
        byte[] byteArray = Encoding.UTF8.GetBytes(postData);
        // Set the ContentType property of the WebRequest.
        request.ContentType = “application/json;odata=verbose”;
        // Set the ContentLength property of the WebRequest.
        request.ContentLength = byteArray.Length;
        request.Accept = “application/json;odata=verbose”;
        // Get the request stream.
        Stream dataStream = request.GetRequestStream();
        // Write the data to the request stream.
        dataStream.Write(byteArray, 0, byteArray.Length);
        // Close the Stream object.
        // Get the response.
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();
        if (response.StatusCode != HttpStatusCode.OK)
        var message = String.Format(“Request failed. Received HTTP {0}”, response.StatusCode);
        throw new ApplicationException(message);
        // Display the status.
        // Get the stream containing content returned by the server.
        dataStream = response.GetResponseStream();
        // Open the stream using a StreamReader for easy access.
        if (dataStream != null)
        StreamReader reader = new StreamReader(dataStream);
        // Read the content.
        string responseFromServer = reader.ReadToEnd();
        // Display the content.
        // Clean up the streams.
        return Ok();
        catch (Exception e)
        throw e;

        private static string GetFormDigest(string webUrl, string username, SecureString password)
        //Validate input
        if (String.IsNullOrEmpty(webUrl) || String.IsNullOrWhiteSpace(webUrl))
        return String.Empty;
        //Create REST Request
        Uri uri = new Uri(webUrl + “/_api/contextinfo”);
        HttpWebRequest restRequest = (HttpWebRequest)WebRequest.Create(uri);
        var credentialCache = new CredentialCache();
        new Uri(webUrl), // request url
        “Digest”, // authentication type
        new NetworkCredential(username, password) // credentials
        restRequest.Credentials = credentialCache;
        restRequest.Method = “POST”;
        restRequest.ContentLength = 0;
        restRequest.UserAgent = “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36”;
        HttpWebResponse restResponse = (HttpWebResponse)restRequest.GetResponse();
        XDocument atomDoc = XDocument.Load(restResponse.GetResponseStream());
        XNamespace d = “http://schemas.microsoft.com/ado/2007/08/dataservices”;
        //Extract Form Digest
        return atomDoc.Descendants(d + “FormDigestValue”).First().Value;

        public static SecureString ToSecureString(string source)
        if (string.IsNullOrWhiteSpace(source))
        return null;
        SecureString result = new SecureString();
        foreach (char c in source.ToCharArray())
        return result;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s