function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Anil KamisettyAnil Kamisetty 

Schema Class - Not returning all Fields

Fields on an Object can be obtained by the following statement.
Note : Asset is the Object API
Map<String,Schema.SObjectField> mfields = Schema.getGlobalDescribe().get('Asset').getDescribe().fields.getMap();
System.debug('Map size = ' + mfields.size()) ; << 26 not 31

I am wondering why the number of elements is returned as 26 not 31 ? Following elements are missed out. List of fields not reported are  productcode, assetprovidedbyid, assetservicedbyid, isinternal, assetlevel (total 5 fields).

Why not all fields are reported in the SCHEMA Class ? As it is salesforce class, it should report everything. On top of it, ASset is a standard object and we are talking about standard fields only

On the Asset object, the standard field API Names are given below (total : 31)

id,contactid,accountid,parentid,rootassetid,product2id,productcode,iscompetitorproduct,createddate,createdbyid,lastmodifieddate,lastmodifiedbyid,systemmodstamp,isdeleted,name,serialnumber,installdate,purchasedate,usageenddate,status,price,quantity,description,ownerid,assetprovidedbyid,assetservicedbyid,isinternal,assetlevel,stockkeepingunit,lastvieweddate,lastreferenceddate