Activity Forums Salesforce® Discussions How to get labels of field for an object in Salesforce?

  • Ayush

    Member
    October 28, 2020 at 5:45 am

    String type='Account';
    Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();Schema.SObjectType leadSchema = schemaMap.get(type);Map<String, Schema.SObjectField> fieldMap = leadSchema.getDescribe().fields.getMap();for (String fieldName: fieldMap.keySet()) {
    System.debug('##Field API Name='+fieldName);// list of all field API name
    fieldMap.get(fieldName).getDescribe().getLabel();//It provides to get the object fields label.}

  • Nitesh

    Member
    October 28, 2020 at 10:20 am

    system.debug( 'Field Label Name is ' + Opportunity.StageName.getDescribe().getLabel() );

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos