I'm fairly new to this. How can I extract a text field String and use it as Boolean in apex logic? For instance, I have a field called Logic__c that contains "mc.Quantity__c == null || mc.Quantity__c == 0". I want to use Logic__c in my apex condition but I don't want to write the actual logic each time. There will be many of these rule logic records so I cannot solve it with validation rules either. Any ideas?
for(Measure_Product_Rule__c mpru : mProductRuleLst){
//if(mc.Quantity__c == null || mc.Quantity__c == 0 ) {
if(Boolean.valueOf(mpru.Rule__r.Logic__c) == true){
Measure_Rule__c mToRule = new Measure_Rule__c();
if(mProductRuleLst.size()> 0) {
mToRule.Rule__c = mpru.Rule__c;
mToRule.Type__c = 'Automatic';
mToRuleLst.add(mToRule);
}
}
}