• Kevin Antonioli 6
  • NEWBIE
  • 5 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
I created an unmanaged package on  my developer org.

1º I had created a FieldSet on Account Called "AccountFilters" and  added some fields like  "AccountSource".
2º I have the following methods:

public Schema.FieldSet getFieldSet(String fieldSetName) {
  Schema.Describesobjectresult result = Account.getSobjectType().getDescribe();
  Map<String, Schema.FieldSet>  fieldSetMap = result.fieldSets.getMap();
  System.assert(fieldSetMap.size() > 0, 'No hay conjuntos para esta clase');
  Schema.FieldSet fs = fieldSetMap.get(fieldSetName);
  System.assert(fieldSetMap.containsKey(fieldSetName), 'No se encontró el conjunto ' + fieldSetName);
  return fs;
}


public Schema.FieldSetMember[] getFields(String fieldSetName) {
  return getFieldSet(fieldSetName).getFields();
}

The method getFieldSet('AccountFilters') works fine and return the expected fieldset, but the method getFields('AccountFilters') returns an empty FieldSetMember[] array. Why?