Hey, I am running a suitelet which takes input CSV...
# suitescript
r
Hey, I am running a suitelet which takes input CSV files and imports custom records into netsuite.. That works good. But i want to process those record after the import, but I don't get those custom records in the map/reduce script. I only run map reduce after the schedule task has "complete" status, but still there seems to be a delay. And map reduce don't get those records. And doesn't work on those. Is there another way?
b
not really enough information to go on, not sure how you are importing those records, nor the link between the map/reduce and how you import those records
r
Through script, task module
Task.create
I have to run map reduce after I import the records
To process the custom records and create a vendor bill from those records
b
there are 2 approaches to importing csv files
are you using the native csv import, or are you parsing the file yourself in a scheduled/map reduce script
r
I am parsing it myself and importing in schedule yes
I am able to import through schedule script
b
most straightforward and error resistant way is to set a field on the record you import so that you can search for it in your map/reduce
r
I am directly searching on the custom records created
Which field do I set? I am getting the custom record created but I am not getting the newly imported records
In the map reduce
b
make a custom field that you use only for identifying records to process in your map/reduce
if you have simple needs, you can make it a checkbox
else a text field that you set to some unique value shared in your batch
r
But still I won't get the records for some reason
I can do that
But the thing is after importing the records through script and after getting the status complete via script. I am running the map reduce and not getting those records
b
what does your map/reduce look like'
r
I don't think the issue is map reduce
Because see, initially there are no records in the system, then I am importing the records through scheduled. And while running the map reduce I am not getting any records
I think my code might be the problem
But I am checking the status and then only running MR
b
that doesnt sound right
normally you would create the map/reduce task using the scheduled script
though honestly you may just want to use a map/reduce to create both the custom record and your transacctions
r
So i should run the import in the get input stage ?
Oh create the record
And everything
I see
I mean I could do that
That is also a good option
I could take the CSV process it all then and there itself
b
your getInputData returns the csv file
netsuite knows how to parse a csv file into rows
then in your map you import the custom records
and the reduce you do the transactions
if you didnt actually need to create the transactipns after all the custom records are created, you can probably create it after you create your custom record in your map entry point
r
You are a saver
Just life saver