Recently I was developing an APEX dynamic action plugin and ran into a bit of an issue. One of the custom attributes that I defined was a yes/no attribute which returned “true” or “false” respectively.
To resolve this problem I just changed my if statement:
//From if (this.action.attribute01) //do something //To if (this.action.attribute01.toLowerCase() == 'true') //do something
x = null; console.log(x, x ? true : false); x = ''; console.log(x, x ? true : false); x = 'false'; console.log(x, x ? true : false); x = 'true'; console.log(x, x ? true : false);
Here are the results: