2

Is there anyway on client side in Dynamics CRM 2011 from JavaScript to retrieve Entity Logical Name by Object Type Code?

Example: Object Type Code = 1, Logical Name is Account

0

3 Answers 3

3

This is unsupported, but it does what you want:

function getLogicalNameFromTypeCode(typeCode) {
    return Object.keys(Mscrm.EntityPropUtil.EntityTypeName2CodeMap).filter(function(key) { 
      return Mscrm.EntityPropUtil.EntityTypeName2CodeMap[key] === typeCode;
    })[0];
}

Usage:

getLogicalNameFromTypeCode(1); // 'account'

Source

Sign up to request clarification or add additional context in comments.

Comments

1

Alternatively don't use the object type code at all. Sort of depends on what your exact usage is, but usually you can get straight to the entity name.

For example, Xrm.Page.data.entity.getEntityName() returns the name of the current entity.

Xrm.Page.data.entity

Comments

0

There's a super easy way.

Using Chrome, and in your CRM site( basically anywhere,) hit F12 go to console, and type:

Mscrm.EntityPropUtil.EntityTypeName2CodeMap

You will see the full list(as picture below) of the EntityTypeName and their Type Code(including your customized entities!)

The sameple list

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.