Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
FYI, switch statements are not loosely typed
Just a little FYI in case anyone runs into this issue. There is a significant and sneaky difference between if/else and switch: switch used a strongly typed comparison (i.e. source and case types must match)
So something like this will fail:
var IDS = { STD:1, EX:2 }; var someIdFromSomewhere = '1'; (note NS field api methods return strings) switch(someIdFromSomewhere) { case IDS.STD: // this will evaluate to false. IDS.STD is a Number and someIdFromSomewhere is a String } It just bit me in the but for about an hour so I thought I would share real quick in case anyone else didn't know or forgot about this detail...
Steve Klett | Senior Developer
NetValue Technology
0