Best practises for creating search in commerce extensions

  • Avoid performing a search per individual line item. Build an array of item records and use that as a filter to execute only one search for all records, instead of performing individual searches per line.
  • Consolidate multiple searches into one search with a broader condition.This consolidation reduces the number of calls you make. If your script performs multiple searches for the same record, manipulate the returned search result in each of the different cases, rather than performing the search repeatedly.
  • Avoid loading the record of each search result.After performing a search, do not use nlapiLoadRecord or nlapiLookupField to load the record into memory to retrieve data. This practice is inefficient because of the unnecessary number of I/O API calls. Instead, prior to running the search, add the desired columns to the search and use getValue.

Leave a comment

Your email address will not be published. Required fields are marked *