Error -Newtonsoft.JsonJsonSerializationException: Self referencing loop detected for property ‘Entity’ …while setting Icons and ToolTips to the Columns in System Views -MS CRM

What is the Issue?

Microsoft Dynamics CRM provided the feature to set Icons and tooltips to the columns in System views based on some conditions like priority task, critical records, Expiry Dates on records, etc. This helps user to take action on or analyze the records.

But sometimes it simply fails and throws exception before loading the view itself. It becomes difficult to figure out issue behind this.

The Reason-

In earlier version of MS CRM i.e. previous to v9.1 where Microsoft provided the feature to add the icons and tooltips to columns, this is working fine for system views of all the entities except Activity entities like email, appointments, Tasks.

The reason behind this is the Party list fields used in entities which are also used in views. Party List fields are lookup fields of multiple entities.

Let’s have an example-

We have the “All Emails” system view for Email entity which is Activity entity.
In system view , there are two fields “From” and “To” as below-

setIcon3

Let’s add javascript on some field to show the icons and ToolTips-

SetIcon7

And publish the Customizations.
When We try to load the view got error message as belows-

setIcon4

When I downloaded the Log file I got some exact error like-

setIcon5

Even If you try to debug the function, you will not be able to do so. It shows exception before hitting the function. So if you take a look closely to the exception from log file it is showing some Error highlighted in above screenshot.

And here you have exact reason-

'from_Value[0].EntityType.Metadata.PrimaryKey'.

From field is Party List field and System is trying to set metadata value for entity of lookup and MS CRM is failing to parse the rowData for this multi-entity type lookup.

Solution-

Only you can remove the all party List columns from system view to make your javascript work for setting Icons and Tool Tips. (This will not the great solution which makes you view useless). So there is no OTHER solution to resolve this issue in earlier versions of MS CRM.

In latest version of MS CRM i.e. V9.1 and above MS has resolved this bug and you can see this working in new versions on MS CRM-

SetIcon2

You can see the “from” and “to” fields are ignored in these views.
Below is the Json rowData value where you can find the blank values for “from” and “to” fields-

SetIcon1

So the issue resolved in latest versions of MS CRM.

Hope this will help you.

Enjoy MS CRM!!!

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