Has anyone triggered the CSV import task with a sp...
# suitescript
n
Has anyone triggered the CSV import task with a specific user from the scheduled script? The user reference is "system" which doesn't send the email to the user when scheduled script runs
e
Scheduled Scripts don't have a user session; they're always executed by System. Which User should it be sent to?
n
A specific user monitored by, say, AR team so they know that CSV has completed and they can download the result file. Currently, when it is triggered by SCH script, AR team cannot download/view result CSV.
t
CSVs are notoriously isolated from everything else for some reason. This has always been a challenge for us
headbang 1
You might be able to do a task.addDependency and have another thing that will notify them afterwards
Okay I don't think that can work
¯\_(ツ)_/¯
e
You could: • Hardcode the email(s) and/or Employee ID(s) in the code • Use a Script Parameter to define the appropriate Employee(s) and/or email(s)
n
@erictgrubaugh even if I use script parameter, those users cannot access the result CSV. Only admin roles can do that. I have previously used a second deployment to check for the task status and then send the email. But the problem here is the result file download limitation.
t
So you can't access or HTML scrape the CSV import status page either because its not available via suitescript and the session object isn't available on the server side so you'd need to reauthenticate. Even if you did the CSV import page has unique ids associated with each CSV status page that doesn't correspond to any task id or value that is useful
I've tried to look into the most janky solutions for this page for various automations and every time I slam my head into a wall that cannot be solved.
r
Same here. Never found a solution to this 😐
n
I am onto something. Will post back if it worked out.
👀 1
🙌 1
I used the RESTlet to trigger the CSV import and it works! User got the email.
t
resourceful
🙂 1
kudos
r
Nice! Thanks for the update! Just to fully understand, so if the scheduled script was the one submitting the CsvImportTask, what you do now is that from the scheduled script you call the Restlet which then triggers the CsvImportTask? And then I assume that the Restlet owner is the specific user that you want to receive the email with the CSV summary. Is that correct or you do something different for the relevant user to get the summary?
n
I used the token of the user who should be notified. That way the CSV import is triggered by that user.
✔️ 1
t
Oh I assumed you ust had a client script trigger this, you're storing / using a token from a SS?
I guess you could probably just store it in an API secrets field and it wouldn't be a huge annoyance to have it as a script parameters or something
n
I have used it as API secret.