Notifications
Announcements
No record found.
Hi ,
I have a requirement to get the object type code for a custom entity in Dynamics CRM online 2016 version. Can anyone help me how to get it through javascript?
*This post is locked for comments
just curious, why you need the object type code? the logical name is not enough?
Hi Guido,
I need to put it on my custom view JavaScript. Do you know how to achieve it?
you will need to query the metadata, but you are with CRM 2016.
Normally I will suggest the SOAP endpoint (example here mileyja.blogspot.com/.../how-to-retrieve-metadata-for-entity.html and the response contains the objecttypecode) but with CRM 2016 you should use the WebApi (example here msdn.microsoft.com/.../mt607522.aspx) but looks like the objectypecode is not returned (at least in their examples) you should check if you can get it using the new WebApi.
However I don't know what you are trying to achieve with "custom view JavaScript" but you should rely on logicalnames, not objecttypecodes
hope it helps
Hi,
Add a client global context to the page, if not exist in the page.
After adding use below code.
var objectTypeCode="";
if (Mscrm.XrmInternal.getEntityCode != null && Mscrm.XrmInternal.getEntityCode != undefined)
objectTypeCode = Mscrm.XrmInternal.getEntityCode("entityLogicalName");
else
objectTypeCode = Mscrm.XrmInternal.prototype.getEntityCode("entityLogicalName");
You could try:
blog.hompus.nl/.../entity-type-code-using-javascript-only
But that's an unsupported method
br Thomas
Hi Laxman,
How to add a client global context to the page?
if you provide your html page url i will suggest it
For my Html Page, i used below path to add
<script src="../../ClientGlobalContext.js.aspx" type="text/javascript"></script>
This context is provided by Microsoft only in CRM.
Thanks,
Laxman P
laxman7790@gmail.com.
We can get objectTypeCode by using webApi.. Following url will return all the custom entity LogicalName and ObjectTypeCode:
{organizational Url}/api/data/v8.2/EntityDefinitions?$select=LogicalName,ObjectTypeCode&$filter=ObjectTypeCode%20gt%209999
This worked. Thank you Muhammad Siddique.
thanks for the Answer. :)
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2