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
alex_from_parisalex_from_paris 

Get description of field label of an object : issue with boolean field

Hi

This is my code :

 

Map<String, Schema.SObjectField> fieldMap  = Schema.SObjectType.Contact.fields.getMap();
                  List<String> fieldNames=getFieldList(fieldMap);
                  String tmp='';
                  for(String fName:fieldNames)
                 { 
          
                     tmp=tmp+fName;
                 }

...

 

with

 

public List<String> getFieldList(Map<String, Schema.SObjectField> fieldMap) {
        //Make a comma-separated list of the fields
        List<String> fieldList =new List<String>();
        for(String fieldName:fieldMap.keySet()) {
            Schema.DescribeFieldResult fieldDescribe = fieldMap.get(fieldName).getDescribe();
            fieldList.add(fieldDescribe.getName());
        }
        return fieldList;
    }

 

 

It returns me all fields of contact object except boolean like "HasOptedOutOfFax" and other custom boolean fields

What am I doing wrong ?

Thanks for your help

Regards

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard
Have you got any field level security that would stop certain profiles seeing those fields?

All Answers

bob_buzzardbob_buzzard
Have you got any field level security that would stop certain profiles seeing those fields?
This was selected as the best answer
alex_from_parisalex_from_paris

Thanks a lot

Since I was acting as a Guest, this was the solution !

Regards