I would love to see some simple mechanism to make ...
# suitescript
p
I would love to see some simple mechanism to make things that i usually code on after submit scripts to be asyncronous.
j
not exactly "simple" but works now you can start an async workflow using N/task, and the async workflow can contain a workflow action script that does whatever you would have done in the afterSubmit
p
I learnt about that in this channel a few months ago, It's cool, definitely! but it's not a very friendly pattern.
j
Ha. Might have been me. Definitely not friendly, but maybe the best choice right now for anything of high or unpredictable latency (in my case it was requests to another server, ranging from 400 to 6000ms)
m
why not use N/task to kick off a scheduled script than a workflow action script?
j
I used a workflow because I could use
N/task#create
to trigger it async (on after submit) and
N/workflow#initiate
to trigger the same process synchronously via a suitelet (when users click a button). Maybe not the most straightforward way to go about not repeating code though. Also, it's unclear to me whether async workflows use the suitecloud processor queue, but in case they do not, I did not want to put jobs in the queue if I could help it
m
thanks