Hey All, Can anybody tell me how I can get these A...
# suitecommerce
h
Hey All, Can anybody tell me how I can get these Associated Images Field in my saved search?
m
You can't get in a saved search. You can use the item api to get the related details.
c
That's right. Unfortuantely, it is one of the "blind-spots" of NS and can't be easily found in a traditional saved search. As Mohammed says, you can do that via the API.
j
@humzariaz Welcome to the battle I’ve been fighting for the last 6 years. For some reason, nobody at NetSuite seems to see the value in returning that information in a search. I eventually stopped pestering them and just wrote a map/reduce script that looped through the images sublist and added a string of JSON that I could parse through in whatever use case I needed the image for (mostly product data feeds)
h
Thanks to All of you for your response !! Yes, @Jacob D That exactly what we actually want to do.
j
I’ll share a snippet of the code I’m using tomorrow. I have posted it before, but it may be archived by now.
h
@Jacob D Yeah sure, I'll be grateful to you.
j
@humzariaz Here is the script that I use. Our use case is pretty specific, but every item on our site is a matrix item. This script is deployed with three parameters: • A search ID for items you want to process. I created a “Process Item Images” custom field on the item record and just execute a simple search for those • Your product images folder (mainly just for producing a final filename/URL) • Your domain (again for producing a filename/URL) Basically, it loads an item, loops through all the available matrix options and pulls the best image match for a matrix option and adds that all to a JSON string. Then, it loops through all the individual matrix children and tries to establish a single image for that child and adds another JSON string in a custom field. It also handles establish image captions, adds them to that JSON string and saves the text in the images caption field. You could manage captions manually in NetSuite, but I find it infinitely easier to manage locally using a bulk file renamer. It requires the file to be named very specifically, but those are noted on line 25. I’m sure you could edit to suit your needs. It’s a map/reduce script because depending on how many images you have, it could consume a lot of governance. I’ve tried to schedule it to run, but it doesn’t really seem to work for whatever reason. I suppose it could be repurposed as a user event script, but it might slow down your item saves. Hopefully this will save you some time or get you on the right track, but if you have any questions, feel free to reach out and I’ll do my best to answer
ItemProcessing-BulkImageUpdate-MapReduce.js
h
@Jacob D Thank you for sharing your experience, I'll back to you after implement your sharings.