You need to sign in to do that
Don't have an account?
Coolday
Only first condition is getting executed in Apex class.
We have a requirement where based on checkbox field different logic should run.
if(fieldname == false || fieldname == true){
//logic
}
else if (fieldname == true){
//logic
}
The issue is only the first condition gets executed.
How can this be resolved.
if(fieldname == false || fieldname == true){
//logic
}
else if (fieldname == true){
//logic
}
The issue is only the first condition gets executed.
How can this be resolved.
A checkbox can have only true or false values. Considering that your first condition is an OR condition that is checking both true and false values, it seems quite obvious that the control will not go to the else statement.
Please cross-check if the OR clause is intended here.
If this information helps, please mark the answer as best. Thank you
Hi swetha,
I want to execute both the logics when checkbox is true what can be done in that condition?
Thanks
if(fieldname == false || fieldname == true){
//logic
}
if (fieldname == true){
//logic
}