I’m running search.lookupFields() on two different...
# suitescript
j
I’m running search.lookupFields() on two different vendors, getting the value of a
custentity
field that is of type Multiple Select (a list of associated custom records). Both vendors I’m testing on have several values selected (10-20 each). My test code looks like this (exact same, except different vendor) // Test 1 search.lookupFields({type: record.Type.VENDOR, id: 42260, columns: [‘custentity_my_multiselect’]}).custentity_my_multiselect; // Test 2 search.lookupFields({type: record.Type.VENDOR, id: 45160, columns: [‘custentity_my_multiselect’]}).custentity_my_multiselect; The first test returns an object with two properties, value and text, both of which are comma-separated strings of integers and text respectively, like so: {value: ‘1,2,3’, text: ‘first thing,second thing,third thing’} The second test returns an object with an array of text/value pairs, where the values are integers expressed as strings, and text are just strings, like so: [{value: ‘4’, text: ‘fourth thing’}, {value: ‘5’, text: ‘fifth thing’}, {value: ‘6’, text: ‘sixth thing’}] What the heck is going on here? Why are the objects from the same call not coming back in the same format?
🤯 3
a
are the selected options in one of them consecutive? and in the other they're just random options selected with gaps between? I could see that being the weird kind of thing that might give you the results you're seeing... not to say that its valid - NS absolutely should NOT be return the same API call with different shapes.
c
does it do the same thing if you just convert it to suiteql? I've seen this before and its not your code its whatever they are doing in the back. Could be a bug still and this was at least a year ago. Other option is to just write a normalize function handle either case.
n
That is truly horrifying.
j
SuiteQL would be fine, was just trying to avoid it in this case. I already got it working by checking if I get an array back or not and converting as needed. At least I’m not going crazy?
r
Not sure about you but this is just making me crazy, Good thing I use suiteql in all my scripts.
j
sidenote: I missed you guys.
🤣 1
☺️ 1
🥹 1