I'm writing a script to save serial numbers which ...
# suitescript
o
I'm writing a script to save serial numbers which needs to be able to potentially handle 100 thousand. They need to be globally searchable so I created a custom record type to store them and link to a PO, sales order, invoice and part #. But I'm running into an issue of scale as I'll run out of governance trying to save them all. If I write a recursive script that calls itself will it get a new allocation of governance each time or do I need to convert to a map-reduce script.
i
Pleass provide more details. Where are those numbers originitaing from? Are they coming from a manual input? And what do you mean by recursive script? A suitelet/restlet that is calling itself?
o
I'm reading in a big xml order status document which contains information on shipments including the serial numbers of the things in each shipment sorted by item number. I want to take each of those unique serial numbers and create a custom record for it to link them to all the other transactions I care about as well as making it globally searchable. So example: My script reads in this: <Order> <ordernum>12345</ordernum> <shipments> <shipment> <item> <itemnum>qwer12</itemnum> <serial>123abc</serial> </item> </shipment> </order>
It pulls out the relevant information and saves it into the appropriate record, but there could be potentially tens of thousands of serial numbers for each item, and I don't have a big enough field on the transaction line item to store all of those. So I want to make a custom child record and link it back to the PO that all of this was generated for.
Then I need to be able to search 123abc and have that serial number and purchase order come up
i
This is exactly the use case for map/reduce. The get inputdata will read and split the file. The map part will group those numbers per transaction(or you can skip this part if there might be too many numbers per transaction) and the reduce part will create the custom entries.