Data Element - Empty String Default Value Bug?



Setting default value for data element 'JavaScript Variable' when the actually JS value is an empty string doesn't return the 'Default Value' is set within the data element. An empty string is returned instead. Since an empty string is considered to be a false type in JS, developers might expect then to rely on the 'Default Value' to be populated instead. 


Is anyone else experiencing this? If so, this should be updated if the JS path resolves but return an empty string vs a ref error, then the data element should fallback on the default value. 



Data Elements default value javascript launch

Accepted Solutions (1)

Accepted Solutions (1)



Default Values get populated on Launch based off:


  • typeof VARIABLE returns "undefined"
  • VARIABLE returns "null"

A blank string is technically a blank string and that would just return naturally.


So the best way is to run a Custom Code and return null when it comes to a blank string.

Answers (0)