You need to sign in to do that
Don't have an account?
Check checkbox value in APEX
Hi,
I have a Checkbox (GST__c) on an object called Product2, I want to check to see if it is checked, if it is checked then apply TAX if not checked don't apply TAX.
This is what i have come up with, do I need to wrap my conditional statement in a function?
Thanks.
I have a Checkbox (GST__c) on an object called Product2, I want to check to see if it is checked, if it is checked then apply TAX if not checked don't apply TAX.
This is what i have come up with, do I need to wrap my conditional statement in a function?
Thanks.
public Product2 product { get { if (product == null) { try { product = ([Select GST__c from Product2 where Id = :prodId]); } Catch (Exception e) { } } return product; } set; } public Boolean GSTRequired {get; set;} if(product.GST__c == true){ // Tax required GSTRequired = true; } else { // Tax not required GSTRequired = false; }
All Answers
--Glad to help
you can try this as well without writing the logic in the constructor