I do know the item internal ID though
# suitescript
c
I do know the item internal ID though
b
standard technique is what @erictgrubaugh told you to do. Do an item search for an item with a matching internal id. get the record type from the search result
c
I’ve put together a saved search
b
more advanced technique is to create another field that uses sourcing to source the item type onto a field on the custom record
c
I’m calling that search but can’t see how to get the type
c
details: searchResult.recordType
how I would I know it’s recordType ?
where would I find that
b
the search result object stores the actual recordType you are looking for in the recordType key
e
Every non-summarized
N/search.Result
instance has an
id
and
recordType
property
j
Copy code
var itemSearchObj = search.create({
   type: "item",
   filters:
   [
      ["internalidnumber","equalto","12345"]
   ],
   columns:[]
});
itemSearchObj.run().each(function(result){
   log.debug('Item Type', result.recordType)
   return true;
});
c
thanks for that - is it best to do my record.load in that callback or can I return the record type from the callback to the caller?
b
not sure how you mean to return the recordType. But the each function is not asynchronous. If you store the recordType in a variable whose scope is outside the callback, its value will be accessible outside of the each callback.
c
I’ll try and make that work
thanks