Whats faster: Getting two field values on a non-t...
# suitescript
d
Whats faster: Getting two field values on a non-transaction record via a saved search, or a load record?
i
nlapiLookupField is the way to go
d
When doing 1 field, I always do lookup value. What about say, 2, 3, or 4?
At what point do i create a search instead? load a record?
i
You can lookup as many fields as you want, just pass an array of field ids. You create a search when you need results from more than 1 records or you need sublist values. You load a record when you need to manipulate sublist values.
d
Am I missing the point or are you? I'm not wondering how to get the values; I was wondering which is faster: LookupField on 2 fields, or LoadRecord and getValue on 2 fields? And at what breakpoint will LookupField be slower than LoadRecord? This is for non-transaction records. Transaction records, LookupField is usually the way to go
Actually the original question was: Creating a search, or Loading the record. So I guess theres three methods now once you add LookupField
Ive tested it in small amounts. It seems like LookupField is faster in almost all cases (i didnt do a
performance.now()
loop with 10000; i just throttled my internet)
Thanks man!
i
Loopup field should be faster than loadRecord in 100% percent of the cases since there is no loading of the whole objRecord from DB. It's a straight up values retrieval from the DB. Also, keep in mind that for loadRecord there could be UE which will make the loading even slower. Anyhow, I am glad I could help.