I want to use custom setting in direct soql statement, but it turns out not working. Because of the requirement, I can't add another field in that object.
The only thing I can do is to use Custom Setting as it might be changed frequently.
Error : System.QueryException: No such column 'defaultPost' on entity
Coding:
MySetting__c mysetting = MySetting__c.getValues('DefaultPost');
Boolean defaultPost = mysetting.booleanValue__c;
String soql = 'SELECT myfield__c'
+ ', Name'
+ ' FROM my_object__c'
+ ' WHERE my_object__c.status__c = \'Open\''
+ ' AND (my_object__c.post__c = true OR defaultPost =:true)';
How can I put Custom Setting in the query which will allow me to change frequently?
I don't want to change the coding so many times for every changes. That is my main purpose.