https://netsuiteprofessionals.com logo
r

razer456

03/27/2022, 2:53 AM
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

battk

03/27/2022, 3:30 AM
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

razer456

03/27/2022, 4:13 AM
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

battk

03/27/2022, 4:15 AM
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

razer456

03/27/2022, 4:16 AM
I am parsing it myself and importing in schedule yes
I am able to import through schedule script
b

battk

03/27/2022, 4:19 AM
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

razer456

03/27/2022, 4:20 AM
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

battk

03/27/2022, 4:31 AM
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

razer456

03/27/2022, 4:35 AM
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

battk

03/27/2022, 4:41 AM
what does your map/reduce look like'
r

razer456

03/27/2022, 4:42 AM
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

battk

03/27/2022, 4:48 AM
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

razer456

03/27/2022, 4:52 AM
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

battk

03/27/2022, 4:59 AM
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

razer456

03/27/2022, 9:55 AM
You are a saver
Just life saver