Friday, October 8, 2021

Unable to Login to Dynamics CRMOrganizationWebProxyClient is null

 While trying to connect to Dynamics CRM Online via a console application, I was having below error

Unable to Login to Dynamics CRMOrganizationWebProxyClient is nullOrganizationWebProxyClient is nullOrganizationServiceProxy is nullOrganizationServiceProxy is nullOrganizationWebProxyClient is nullOrganizationServiceProxy is nullOrganizationWebProxyClient is nullOrganizationWebProxyClient is nullOrganizationServiceProxy is nullOrganizationServiceProxy is nullOrganizationServiceProxy is null


Below is a specific code that works perfectly fine

public static IOrganizationService getProdOrgService()

{

IOrganizationService organizationService = null;

 

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 |                                                         SecurityProtocolType.Tls;


ClientCredentials clientCredentials = new ClientCredentials();

clientCredentials.UserName.UserName = ConfigurationManager.AppSettings["D365Username"];

clientCredentials.UserName.Password = ConfigurationManager.AppSettings["D365Password"];

organizationService = (IOrganizationServicenew OrganizationServiceProxy(new Uri(ConfigurationManager.AppSettings["orgserviceUrl"]),      null, clientCredentials, null);

 

 

return organizationService;

}



Add the following to your AppSettings


<add key="D365Username" value="vipin@vjcity.com" />

<add key="D365Password" value=" vjcity " />

<add key="orgserviceUrl" value="https:// vjcity.crm.dynamics.com//XRMServices/2011/Organization.svc" />



Correct your AssemblyVersion if problems persist

https://vjcity.blogspot.com/2021/07/assembly-microsoftcrmsdkproxy-with.html


Wednesday, October 6, 2021

How to Connect TFS from Visual Studio and create local repository

 Launch Visual Studio and Continue without code


Launch Team Explorer and click to connect Icon


Provide your credential to connect to Azure Dev Ops Project. Once connected it will list out various projects to which you are having access.


Once you click the Clone Button it will copy all the code to your local machine.





Monday, August 30, 2021

Ribbon Workbench - For Performance reasons, this solution cannot be loaded

Recently, we were working on button customization in a new environment. 

It so happened that we downloaded the latest solution from develop[1]


But from the latest version - 3.1.443.1, we were facing the below problem for any solution we are trying to import.

For Performance reasons, this solution cannot be loaded:

The solution contains non-entity components (e.g. attributes/forms/apps/dashboards/workflows).

Please create a solution and add only the Entities you wish to edit, with no sub-components!



SOLUTION:

Just try with an old version of the Ribbon Workbench and its works like a charm.

I hope develop[1] team is working on this and soon it is going to resolve this issue. 

Thanks a lot to develop[1] team for making life easy with Ribbon Workbench Tool







Saturday, July 17, 2021

Assembly 'Microsoft.Crm.Sdk.Proxy' with identity 'Microsoft.Crm.Sdk.Proxy, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'Microsoft.Xrm.Sdk' with identity 'Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

 Please refer here for more details, usually when there is a mismatch for DLLs version this error occured.

https://vjcity.blogspot.com/2021/07/could-not-load-file-or-assembly.html


Remove the wrong version of the DLL’s and add the correct version of the DLL’s



If you are getting

Unable to Login to Dynamics CRMOrganizationWebProxyClient is null

Refer here - https://vjcity.blogspot.com/2021/10/unable-to-login-to-dynamics.html


Could not load file or assembly 'Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.

We all D365 Developers came across this annoying error often. Today, we will try to understand this one and quickly resolve it if it appears next time.

When connecting to Dynamic CRM we are required a couple of DLL’s which are

  • Microsoft.Crm.Sdk.Proxy                         :         9.0.0.0
  • Microsoft.Xrm.Sdk                                   :         9.0.0.0
  • Microsoft.Xrm.Sdk.Deployment               :         9.0.0.0
  • Microsoft.Xrm.Tooling.Connector            :         3.0.0.0

Now these DLL’s must be in one common version only either 8.0.0.0 or 9.0.0.0. If any one of these DLLs is not synced version-wise, then during runtime we have an error.

We can check the version of DLL’s from a property window in Visual Studio.


Remove the wrong version of the DLL’s and add the correct version of the DLL’s




Now the NuGet way, verify if you have the same version installed. 

 


Important Note: If you see the version of the NuGet same and still, run into the problem, then Uninstall the NuGet and Clean and Re-Build the solution or try verifying individual DLL’s version as explained above.






Wednesday, July 14, 2021

How to search in multiple table from a lookup in Dynamic CRM

Now we can use a single lookup field to refer multiple entities for searching (including a custom entity)

A lookup value submitted will be matched to a record in all the related entities.

Note: For now, to achieve this it is possible only via SDK or Web APIs. Interactive user interface support will be coming in a future release. 

Example:

Let's say you are hosting media for users in a library. You have many different MediaObjects, like “Books”, “Audio”, and “Video”. Creating a multi-table lookup called “new_Media” that has 1:M relationships to “new_Books”, “new_Audio”, and “new_Video” will result in a “new_Media” lookup table that provides quick identifications of records stored in specific tables.

 



Shown below is an HTTP post to CREATE Multiple lookup attribute.

It will create three relationships as depicted below image.


POST [Organization URI]/api/data/v9.0/CreatePolymorphicLookupAttribute HTTP/1.1 

 

Accept: application/json 

Content-Type: application/json; charset=utf-8 

OData-MaxVersion: 4.0 

OData-Version: 4.0 

 

{

 "OneToManyRelationships": [

   {

     "SchemaName""new_media_new_book",

     "ReferencedEntity""new_book",

     "ReferencingEntity""new_media"

   },

   {

     "SchemaName""new_media_new_video",

     "ReferencedEntity""new_video",

     "ReferencingEntity""new_media"

   },

   {

     "SchemaName""new_media_new_audio",

     "ReferencedEntity""new_audio",

     "ReferencingEntity""new_media",

     "CascadeConfiguration": {  

        "Assign""NoCascade",  

        "Delete""RemoveLink",  

        "Merge""NoCascade",  

        "Reparent""NoCascade",  

        "Share""NoCascade",  

        "Unshare""NoCascade"  

     }

   }

 ],

 

 "Lookup": {

   "AttributeType""Lookup",

   "AttributeTypeName": {

     "Value""LookupType"

   },

 

   "Description": {

     "@odata.type""Microsoft.Dynamics.CRM.Label",

     "LocalizedLabels": [

       {

         "@odata.type""Microsoft.Dynamics.CRM.LocalizedLabel",

         "Label""Media Polymorphic Lookup",

         "LanguageCode": 1033

       }

     ],

 

     "UserLocalizedLabel": {

       "@odata.type""Microsoft.Dynamics.CRM.LocalizedLabel",

       "Label"" Media Polymorphic Lookup Attribute",

       "LanguageCode": 1033

     }

   },

 

   "DisplayName": {

     "@odata.type""Microsoft.Dynamics.CRM.Label",

     "LocalizedLabels": [

       {

         "@odata.type""Microsoft.Dynamics.CRM.LocalizedLabel",

         "Label""MediaPolymorphicLookup",

         "LanguageCode": 1033

       }

     ],

 

     "UserLocalizedLabel": {

       "@odata.type""Microsoft.Dynamics.CRM.LocalizedLabel",

       "Label""MediaPolymorphicLookup",

       "LanguageCode": 1033

     }

   },

 

   "SchemaName""new_mediaPolymporphicLookup",

   "@odata.type""Microsoft.Dynamics.CRM.ComplexLookupAttributeMetadata"

 }

}



Add new relationship to existing Multiple-lookup

POST [OrganizationUrl]/api/data/v9.0/RelationshipDefinitions

{

  "SchemaName": "new_media_poly_new_newspaper",

  "@odata.type": "Microsoft.Dynamics.CRM.OneToManyRelationshipMetadata",

  "CascadeConfiguration": {

    "Assign": "NoCascade",

    "Delete": "RemoveLink",

    "Merge": "NoCascade",

    "Reparent": "NoCascade",

    "Share": "NoCascade",

    "Unshare": "NoCascade"

  },

  "ReferencedEntity": "new_newspaper",

  "ReferencingEntity": "new_media",

  "Lookup": {

    "AttributeType": "Lookup",

    "AttributeTypeName": {

      "Value": "LookupType"

    },

    "Description": {

      "@odata.type": "Microsoft.Dynamics.CRM.Label",

      "LocalizedLabels": [

        {

          "@odata.type": "Microsoft.Dynamics.CRM.LocalizedLabel",

          "Label": "Media Polymorphic Lookup",

          "LanguageCode": 1033

        }

      ],

      "UserLocalizedLabel": {

        "@odata.type": "Microsoft.Dynamics.CRM.LocalizedLabel",

        "Label": "Media Polymorphic Lookup Attribute",

        "LanguageCode": 1033

      }

    },

    "DisplayName": {

      "@odata.type": "Microsoft.Dynamics.CRM.Label",

      "LocalizedLabels": [

        {

          "@odata.type": "Microsoft.Dynamics.CRM.LocalizedLabel",

          "Label": "MediaPolymorphicLookup",

          "LanguageCode": 1033

        }

      ],

      "UserLocalizedLabel": {

        "@odata.type": "Microsoft.Dynamics.CRM.LocalizedLabel",

        "Label": "MediaPolymorphicLookup",

        "LanguageCode": 1033

      }

    },

    "SchemaName": "new_mediaPolymporphicLookup",

    "@odata.type": "Microsoft.Dynamics.CRM.LookupAttributeMetadata"

  }

}


Finally, we can see all entities in lookup





References

https://powerapps.microsoft.com/en-us/blog/announcement-multi-table-lookups-are-now-available-as-a-preview/

https://docs.microsoft.com/en-us/powerapps/developer/data-platform/webapi/multitable-lookup?branch=pr-en-us-4448