I needed a facet in SuiteCommerce that showed whether an item was in stock or not. The problem: I had multiple warehouses. In order to know whether I had stock or not, I needed to sum across all warehouses. So the quantity available didn’t work in a custom item field. It threw an error.
First… A huge “Thank You” goes out to Kwini with NetSuite support. She solved this one for me!
Here’s the solution. It was a multi-step process that included a saved search and 2 custom item fields. Yikes!!!
Here’s how it all fit together.
Start with a saved search. Only Inventory Items can have stock. So filter out the rest. They are superfluous.
Editor’s note: We found later that if you don’t make this search public, it works for everyone. However, only the owner showed items as “In Stock”. Everyone else showed every item as “Not in Stock.”
In the results tab of the same saved search, be sure to sum the quantity available.
Same saved search… In order to limit the results to just one item, you need to set the available filter to the internal ID of an item and you need to make sure you check to show the filter in the filter region.
This completes the saved search. Save it!
Next, you need to create a custom item field that holds the results of the aforementioned search. It is not necessary, but I marked this interim custom field as hidden. The important things to remember are that it must reference the saved search and it must be free-form text.
And finally, I created the custom item field that I actually wanted to begin with and plan to make a facet field in SCA. It uses a formula to decide whether the item is in stock or not.
Hopefully, this is helpful. I know I’ll be back here reading my own blog post when I forget how to do this in the future.
Cheers!