Skip to content

Instantly share code, notes, and snippets.

@W3BGUY
Created June 7, 2021 11:41
Show Gist options
  • Save W3BGUY/d703118b3c92c66b1b864a8e297066f7 to your computer and use it in GitHub Desktop.
Save W3BGUY/d703118b3c92c66b1b864a8e297066f7 to your computer and use it in GitHub Desktop.
Simply function to get any item type by internal ID. Adding this since I've seen multiple questions about how to do it.
function getItemType(itemID){
var itemData={};
try{
itemData=search.lookupFields({type:search.Type.ITEM,id:itemID,columns:['type','externalid','price','displayname']});
log.debug('itemData',JSON.stringify(itemData));
}catch(err01){
log.error('getItemType('+itemID+').err01',JSON.stringify(err01));
}finally{
return itemData;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment