I had a NS support tech today tell me that the safest variable type to pass to record.setValue() is a string (for the actual value...)... even if the underlying field you are setting is not a string....
This came about due to a UserEvent script we have that was throwing very intermittent errors when we were setting, via setValue(), a JavaScript integer to a custom field of type 'Integer Number'. NS would sometimes interpret the integer as a decimal and use that instead. For example, if var theValue = 10; NS would then try to use 10.0 as the value which of course is a decimal and rightly throw an error when setting the value. I know that it was trying to use 10.0 because that value would specifically be stated in the error's stack trace.
Has anyone else come across, experienced this or gotten this advice? This seems very unusual to me, but appeding toString() on the integer did resolve our issue.