Thursday, May 16, 2019

Why are arguments passed to User Event functions of type Object and not string

When evaluating typeof() on User Event arguments, Object type is returned for string values.

For example as shown on the following image, when calling typeof(type) where "type" is one of the User Event script function arguments, typeof() returns object and not string:



This is because arguments passed to User Event functions by NetSuite are instances of String object and not string variables. This is also described here: http://www.w3schools.com/js/js_obj_string.asp

To check whether a variable is a string or not, following code can be used:

No comments:

Post a Comment