简体   繁体   中英

How to get field types in MS CRM 2011

I am new at programming altogether and need your help in finding a way out to the below query: I need to find all the fields on a 'abc_contact' page with same field type (single line of text and multiple lines of text) and then perform some logical operation. How can I get all the fields of same type through JavaScript?

As @Guido points out in his comment, you can access an attribute's type using:

Xrm.Page.getAttribute(arg).getAttributeType()

You can get all of the attributes from the entity attribute collection, loop through them and get their types:

Xrm.Page.data.entity.attributes.forEach(function (attribute, index) { var attributeType = attribute.getAttributeType(); // Perform logic based on attribute type });

Attributes collection reference: https://msdn.microsoft.com/en-us/library/gg334720.aspx#BKMK_entityattributes

Type TYP = (entityObj.Attributes["columnName"]).GetType(); string TypeVal = TYP.FullName.ToString();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM