Answers for "schema.fieldsetmember in salesforce"

0

schema.fieldsetmember in salesforce

public class AccountFieldSetController {
    public String queryString{get;set;}
    public List<Account> accList{get;set;}
    public AccountFieldSetController(){
        queryString = 'select id';
        for(Schema.FieldSetMember fld :SObjectType.Account.FieldSets.accountFieldSet.getFields()) {
         queryString += ', ' + fld.getFieldPath();
        }
        queryString += ' from Account limit 5';
         
        acclist = Database.query(queryString);
    }
     
}
Posted by: Guest on May-11-2020
0

schema.fieldsetmember in salesforce

public static List<Schema.FieldSetMember> readFieldSet(String fieldSetName, String ObjectName)
{
    Map<String, Schema.SObjectType> GlobalDescribeMap = Schema.getGlobalDescribe(); 
    Schema.SObjectType SObjectTypeObj = GlobalDescribeMap.get(ObjectName);
    Schema.DescribeSObjectResult DescribeSObjectResultObj = SObjectTypeObj.getDescribe();
 
    //system.debug('====>' + DescribeSObjectResultObj.FieldSets.getMap().get(fieldSetName));
 
    Schema.FieldSet fieldSetObj = DescribeSObjectResultObj.FieldSets.getMap().get(fieldSetName);
 
    //List<Schema.FieldSetMember> fieldSetMemberList =  fieldSetObj.getFields();
    //system.debug('fieldSetMemberList ====>' + fieldSetMemberList);  
    return fieldSetObj.getFields(); 
}  
Posted by: Guest on May-11-2020
0

schema.fieldsetmember in salesforce

<apex:page controller="AccountFieldSetController" tabStyle="Account">
  <apex:form >
      <apex:pageblock >        
          <apex:pageBlockSection title="Account list" collapsible="false">
             <apex:pageBlockTable value="{!accList}" var="acc">
                 <apex:repeat value="{!$ObjectType.Account.fieldsets.accountFieldSet}" var="fieldValue">
                     <apex:column value="{!acc[fieldValue]}">
                     </apex:column>
                 </apex:repeat>
             </apex:pageBlockTable>
          </apex:pageBlockSection>
           
          <apex:pageBlockSection title="Account Dynamic query" collapsible="false">
              <apex:outputText value="Query is: {!queryString}" />
          </apex:pageBlockSection>
           
      </apex:pageblock>
    </apex:form>
</apex:page>
Posted by: Guest on May-11-2020

Code answers related to "schema.fieldsetmember in salesforce"

Browse Popular Code Answers by Language