You need to sign in to do that
Don't have an account?
Karen Davis 1
How do I add a true or false if statement to my javascript button?
I'm trying to add a condition to a javascript button that already works, but it's not working. If a checkbox called "Allow_new_exam_assessment__c" is true, then I want to execute the rest of the button script. If it's false, I want to generate an error message. Here's what I have - can someone tell me how it should be formatted? (
if('{!Treatment__c.Allow_new_exam_assessment__c}') {
(this is where the rest of the code is - not putting it all here becuase it confuses things)
}
else
{
alert("An exam assessment already exists for today or yesterday.");
}
if('{!Treatment__c.Allow_new_exam_assessment__c}') {
(this is where the rest of the code is - not putting it all here becuase it confuses things)
}
else
{
alert("An exam assessment already exists for today or yesterday.");
}
VineetKumar
Doing this '{!Treatment__c.Allow_new_exam_assessment__c}' will typecast your boolean value in string, and you can no longer use it directly in if condition, you might have to do something like below
Just put an alert above, to check the actual value.