Based on profiles fields should be display like system admin can see all the account fields other profiles will see limited fields how can solve this by using custom settings?

  • Why not use Field Level Security? – sfdcfox Mar 21 at 7:08
  • Here i am writing controller & vf to display – srinivas Mar 21 at 7:11

please try below code to find fields which are accessible.

public static Account getFields(){

    string sObjectType = 'Account';
    SObjectType schemaType = Schema.getGlobalDescribe().get(sObjectType);
    Map<String, SObjectField> fields1 = schemaType.getDescribe().fields.getMap();
    List<String> fieldscdm = new List<String>(Account.SObjectType.getDescribe().fields.getMap().keySet());
    List<String> fields2 = new List<String>();
    for (String field : fieldscdm){
        if (fields1.get(field).getDescribe().isAccessible())
        //continue your logic after you get accessible fields

  • by using custom setting how we can achieve above task? – srinivas Mar 21 at 7:18
  • why do you want to use custom setting ? – 7'7' Mar 21 at 7:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.