-2

Is there a way to retrieve field API vs help text map or get the help text for fields.

String Field_Name=SObject.Field__c.getDescribe().getInlineHelpText();
 for(String fP: valuemap.keySet()){
                system.debug('fP'+fP);
                Object 
          helpText=Account.fP.getDescribe().getInlineHelpText();
                Object value = sc.get(fP); 
                mapObj.put(fP, String.valueOf(value));
            }

valuemap.keySet() is having the api name which i am iterating. Giving error "Variable does not exist: Account.fP"

  • 1
    It looks like you know the method getInlineHelpText(), which is how you obtain this data point. What specifically are you struggling with? – David Reed Jul 24 '19 at 12:48
  • yes i can get the help text of perticular field but i have to create a map of api name and help text and i dont want to put getDescribe inside the for loop while checking keyset from other map to get the key as api and value as helptext. – Edward Jul 24 '19 at 13:28
1

You'd want to start from the field map and describe the fields:

Map<String, String> helpTexts = new Map<String, String>();
for(SObjectField field: SobjectType.Account.fields.getMap().values()) {
    DescribeFieldResult des = field.getDescribe();
    helpTexts.put(des.getName(), des.getInlineHelpText());
}
|improve this answer|||||

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.