CRM 2011: Get entity type code of a lookup field
-
30 Mayıs 2012 Çarşamba 11:09
Hi all, in order to get the entity type code of a lookup field, we need to use the following statement:
Xrm.Page.getAttribute( "lookupfieldname" ).getValue()[0].type;
But this will work only if the field is not empty, the question is how to get the entity type code of an empty lookup field ?
Best regards..
Tüm Yanıtlar
-
30 Mayıs 2012 Çarşamba 11:17Moderatör
Hi Mostafa,
you need to detect it from relationship schema, you need to query relationship to get entity type code.
Mahain : Check My Blog
Follow me on Twitter
Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question. -
30 Mayıs 2012 Çarşamba 11:31Moderatör
Hello,
You can use following unsupported trick (but it would not work properly for multientity targeted fields like customer or regarding):
var referenceentityname = document.getElementById('fieldname').getAttribute('lookuptypenames').split(':')[0];
Microsoft CRM Freelancer
My blog (english)
Мой блог (русскоязычный)
- Yanıt Olarak Öneren Andrii ButenkoMVP, Moderator 30 Mayıs 2012 Çarşamba 11:35
- Yanıt Olarak İşaretleyen mo32 30 Mayıs 2012 Çarşamba 11:59
-
30 Mayıs 2012 Çarşamba 11:34
Thanks alot Andrii,
Dear Mahendar, would you please provide more details about your solution ??
-
30 Mayıs 2012 Çarşamba 11:51Moderatör
Hi,
you need to retrieve entity metadata based on relationship filter, then you can check for entity type code.
you can refer :http://mileyja.blogspot.in/2011/05/how-to-retrieve-metadata-for-entity.html
Mahain : Check My Blog
Follow me on Twitter
Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.