get fields dynamically from custom settings or field set salesforce

string query = 'Select ID';
for(Schema.FieldSetMember f :SObjectType.Campaign.FieldSets.SST_CampaignFields.getFields()){
    query = query + ', '+f.getFieldPath();
}
query = query + ' from campaign limit 10';
system.debug('Queury : '+query);
List<Campaign> camp = database.query(query);
system.debug('Queury : '+camp);
for(campaign c : camp){
   system.debug('Queury : '+c);
}


No comments:

Featured

What is Cryptography in salesforce and what are all the algorithms provided by them ?

A). It is a security protocal between two systems. Lets say we are integration two systems without any encrytion mechanism then hackers wil...

Popular