Menu Close

Remove $id from Custom Web Service JSON – Dynamics 365 F&O

Priority-Based Throttling in Microsoft Dynamics 365 Finance and Operations (F&O, SCM) is almost mandatory!  If your solution or integration architecture included the transaction orchestration being done outside of F&O (multiple OData calls within a transaction; rollback means making more OData calls), one of the things you can do to adjust it is to create a custom web service in F&O, which would handle an entire transaction.

It is easy to develop a custom web service in F&O by creating the following objects:

  • Class with public method
  • Service
  • Service Group
  • Security Privilege
  • Contract classes, as needed
  • SysTest (ATL) class(es), as much as desire allows

When you want to have a list of objects, you create a DataContract class and return it as a list (see line 22 below).

Ugh, what are these unnecessary $id fields?

Rid yourself of this unnecessary data and bandwidth hog- Use the following decorator on your contract classes to remove those (as seen in above screen shot).

[Newtonsoft.Json.JsonObjectAttribute(IsReference = false)]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.