0

I'm trying to speed up my ssp application by using nlapiLookupField where possible instead of having to load the whole record and it's sublists using nlapiLoadRecord. Unfortunately it doesn't seem to work with lineitem fields. Is there an api call to fetch a line item's value with out the needing to use nlapiLoadRecord?

I'm using 1.0 as dictated by SCA.

Matt
  • 33
  • 6

2 Answers2

4

nlapiLookupField() is limited to body fields, however you can use other search apis (eg: nlapiSearchRecord()) to return any information that a saved search can access, which obviously includes item lines. This is particularly useful if you want to read a few fields from a large number of records, but I believe it's performant compared to loading a record even if you just return a single result, say by passing in an internal id as one of the filters. I haven't tested to compare a single result search with a single record load though, so YMMV.

Krypton
  • 4,394
  • 2
  • 9
  • 13
  • i was under the impression that you're not able to access lineitems from search. at least in 1.0 – Matt Jan 08 '19 at 17:46
  • 1
    No, you can definitely access the line items using `nlapiSearchRecord`. Try opening a new transaction in NetSuite, then press F12 to open Developer tools, and run the following in the console: `nlapiSearchRecord("salesorder",null,[["internalid","anyof",1720985]],[new nlobjSearchColumn("entity"),new nlobjSearchColumn("item")]);` (Replace the 1720985 with a valid sales order internal id from your system). Observe that more than one line is returned. This will include the main line, item lines, tax lines etc - exactly as you would see returned in the UI. – Krypton Jan 08 '19 at 18:47
  • i believe this is restricted to transactions only. unfortunately my target record is subscription and doesn't qualify. i'm sorry for not specifying my record type in the original question. – Matt Jan 09 '19 at 15:23
  • I don't use subscriptions, so I can't speak specifically to them, but it's definitely not just transactions. I can get all types of lines from items and customers for example. Sometimes you have to use a join to do so, but basically if you can create a search in the UI which returns what you want, you can do it via scripting too. – Krypton Jan 09 '19 at 15:50
2

Unfortunately, no. Only body fields are supported with nlapiLookupField or search.lookupFields.

ehcanadian
  • 1,738
  • 1
  • 15
  • 23