I am looking to make dynamic queries, but I want to avoid compound fields in the query. Is there any way to check if the fields is a compound or overall not updateable?
public List<Sobject> DynamicSOQL(String objectName, Set<Object> IdsToQuery)
{
String SobjectApiName = objectName;
Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
Map<String, Schema.SObjectField> fieldMap = schemaMap.get(SobjectApiName).getDescribe().fields.getMap();
List<String>apiNames = new list<String>();
for(String apiName : fieldMap.keyset())
{
apiNames.add(apiName);
}
string allstring = string.join(apiNames,',');
query = 'SELECT ' + allstring + ' FROM ' + SobjectApiName + ' WHERE Id in' :IdsToQuery + ' Limit 3';
Account[] accList = Database.query(query);
return accList;
}