I'm creating a custom execute JavaScript button for the Opportunity detail page and trying to use an IF statement to conditionally load a resource with REQUIRESCRIPT. The goal is to base the condition on the value of a checkbox (Active__c) on the related Account record. Here's the button formula:
{!
IF(Account.Active__c,
REQUIRESCRIPT("data:application/javascript;base64,YWxlcnQoJ2hlbGxvJyk="),
''
)
}
alert('{!Account.Active__c}')
The formula never evaluates to true regardless of the Active__c
field being true or false so the REQUIRESCRIPT never loads. If I base the condition on a checkbox on the Opportunity record, it works fine.
The click-activated alert displays the correct values for Active__c
so the formula is getting something for that field, but it doesn't seem to be able to reference it correctly in the IF statement. Oddly, if I create some other type of condition like Account.Text_Field__c = 'text'
, it works correctly. The issue seems to be limited to booleans.
Is this just a limitation of custom buttons, or am I doing something wrong here?
In this mockup, the JavaScript encoded in the REQUIRESCRIPT
is just an alert popup that says 'Hello' when the script loads.