Posts

Showing posts from 2019

WebAPI Query | Dynamics CRM | Error: Property 'field' on type 'Microsoft.Dynamics.CRM.entity' is not a navigation property or complex property

Image
Recently when I was debugging my code I got this error : Property 'field' on type 'Microsoft.Dynamics.CRM.entity' is not a navigation property or complex property'.

Basically in my WebAPI query I was requesting data from Survey entity and also I was trying to read related entity(in my case it is Incident) data values so that I don't have to do another query.

I have this 'Survey' entity and which has a lookup field called 'Regarding' (Schema name: regardingobjectid) which is a and can be related to any system defined entity.

Simply when I used regardingobjectid in my query I got error : "Could not find a property named 'regardingobjectid' on type 'Microsoft.Dynamics.CRM.msdyn_surveyinvite'." I removed this '$select' part from the url and directly run that and found that there is field called '_regardingobjectid_value' which returned guid of that 'Regarding' lookup field.

Now the new error came wh…

How to query paging using Dynamics 365 WebAPI (More than 5000 records)?

Recently I was working on a requirement where I had to build a WinForm application to get the records from multiple entity which looks like a very simple requirement and it was indeed but the problem came when I completed my code using WebAPI method and server-to-server authentication. The problem was the size of records which was more than 5000 and I had no idea how to query paging in this scenario.

Paging using the webAPI is a bit different to using the SOAP endpoint, so I've described the structure of request that should be used and how to navigate to the next page from the response.


* To execute the request for the next batch of records after maxbatchsize of request is reached, simply open a new request to the URI specified in the @odata.nextLink attribute using the same header as the initial request.

Here is the example of HTTP response which you'll get. Please look at the end carefully, we got the next page link in the @odata.nextLink attribute because the response reac…

Promise in JavaScript | Async Calls | Dynamics CRM

I am going to explain how we can use promise in our CRM script with little explanation about promise.

Let's suppose you have multiple functions in your script and one of those function (name funA) does take time to execute and other function (name funB) in script depends on the result of that function (funA) result.

A 'promise' is a special JavaScript object that links both these functions; funA & funB together. Promise makes the result available to funB when it is ready from functionA.

Basic syntax of a promise is:

var promise = new Promise(function (resolve, reject) {//Producing code let condition = 1; if (condition < 1)                 resolve(); else                 reject();         });
The function passed to new Promise is called the executor. When new Promise is created, it runs automatically. It contains the producing code, that should eventually produce a result. When the executor obtains the result, be it soon or late – doesn’t matter, it should call one of t…

Unified Service Desk generic error: Creating An Instance with CLSID from the IClassFactory failed

Image
Sometime user get this error when they open Unified Service Desk: Creating an instance of the COM component with CLSID {0002DF01-0000-0000-C000-000000000046} from the IClassFactory failed due to the following error: 8150002e Exception frm HRESULT: 0x8150002E



For resolving this issue simply do the following steps and then re-start your USD and that's it, issue solved :)

1. Open Task Manager
2. Goto Details tab
3. Look for all iexplore.exe
4. Right click on each of them and select 'End process Tree'

How to establish Server-to-Server Authentication | Dynamics D365 | Azure | CRM Web API

Image
In this blog, I'll explain all steps that how to establish server-to-server authentication using Application User and Azure active directory.
I have a very basic requirement to fetch case guid from incident entity based on ticket number from CRM using S2S authentication i.e without using any CRM user credential. Follow the below steps:
Step 1:First of all we need to create an App in the Azure application directory : Goto http://portal.azure.com and enter your credentials.Goto Active Directory > App Registrations > New RegistrationsProvide all basic details as in screenshots below and click on Register




Once the application is created, you will get an application ID (marked with red arrow in image below), copy and paste somewhere; this is your client ID


Next step is to create Client Secret for which click on 'Certificates and Secrets' (or Keys for old Azure UI) as shown in image below. This key is used to establish connection in your application. Click on 'New Client…
go to top image