Hi all hope you’re doing great. I posted this on <...
# suitescript
p
Hi all hope you’re doing great. I posted this on #C5Y8YA27Q but this might be a better place to talk about it (but if this is not the right channel please point me to the right place!) I was tasked with helping out connect to a 3rd party to share product details (basic info with stock and price) via a Scheduled Script, but I’m pretty new to Netsuite and I’m quite lost: • Can anyone point me to some basic examples on pulling product data? I’m able to do a basic
search.create({type: search.Type.INVENTORY_ITEM…})
but what if not all custom fields are part of that type? • Is there a way to visualize the whole DB schema or to find out all the custom fields that were created for this company? (I was not here when these were created). Currently the script is pulling 3 custom fields from _inventory_item_ but two of those are returning simply “1” and “2" instead of their actual value. Plus there are other fields that I cannot for the life of me figure out where I can get them from. I tried exploring by going to Setup > Records Catalog and I did find some of the stuff I need but I do not understand what the Join column really means. • Once I figure out how to get the remaining data, is there an easy way to join together the results if they’re not part of the same search? (sort of like when you do joins in a sql query?) Happy to share code or join a quick call if need be.
c
@Pp Dany Leal • Try
search.Type.ITEM
to access fields across item types • the Join column relates to using SuiteQL to join between tables • You can process search or query results in SuiteScript and join together using fairly standard Javascript methods e.g. iterating over result arrays and composing a new synthesized object
❤️ 1
p
Thanks @Clay Roper , will give it a try and see how it goes. Is there an easy way to retrieve / log all the columns on that type though? Last I tried, it just logged “{}” without printing the actual column titles
c
You can use the Records Browser (different to the catalog) to review the standard search columns available to you (excluding custom fields). I'm not aware of a way using N/search in SuiteScript to return all columns; you can use N/query to
SELECT *
to describe a table, but there is not a 1:1 equivalency between N/search and N/query in terms of column naming and availability.
👍 1