This topic contains 3 replies, has 0 voices, and was last updated by chanarbon 8 years, 2 months ago.
-
AuthorPosts
-
September 2, 2016 at 9:55 am #1836
david.smithAnyone find it weird or wrong that the lookupFields returns an array for the select field? I see this as necessary for multiselect fields but not for a regular select.
https://netsuite.custhelp.com/app/an…ail/a_id/43711
This is a cached copy. Click here to see the original post. -
September 4, 2016 at 10:39 pm #1837
michoelAbsolutely, it took me a while to figure this out. It’s unintuitive and seems pointless.
I also prefer the way SS1.0 returns the value directly instead of an object if you are only looking up a single field.
SS1.0
Code:
var salerep = nlapiLookupField(‘customer’, id, ‘salesrep’);
SS2.0Code:
var results = search.lookupFields({type: search.Type.CUSTOMER, id: id, columns: ‘salesrep’});
var salesrep = results.salesrep[0].value;
Considering that this function is basically a convenience wrapper function instead of doing a search directly it should be as convenient as possible.. -
September 6, 2016 at 7:15 am #1838
ironsideIf it were convenient, it wouldn’t require passing an object with properties for the function params. Just count the number of characters and notice how much longer the SS2.0 solution is. In this regard, SS2.0 is a step backwards from SS1.0.
david.smith replied on 09/06/2016, 08:47 AM: I’ve been doing a lot with SS2.0 and I’m still neutral about if it’s better or not. I do like working with objects much better. I’ve found some advantages and a few bugs.
-
September 19, 2016 at 10:35 pm #1839
chanarbonHi David,
Yes. It returns an array which means that you always have to expect that you need to check whether the result has a content through the result value’s length. But I agree that regular select fields are better off as objects instead of array of objects with one element
-
AuthorPosts
You must be logged in to reply to this topic.
