In general, do workflows perform better than scrip...
# suitescript
x
In general, do workflows perform better than script? I've heard two different things in the past (not here).
s
I get the impression workflows are run similarly to script. I wouldn't be surprised if they compile to something similar to SuiteScript. Anyway, in my experience if I'm responsible for it, a suitescript is easier. Even for simple 'set a field' workflows, SuiteScript (with NFT) is simpler, and much easier to extend.
m
NetSuite internally compiles Workflows into scripts. You can see this yourself if you create a workflow with client triggers and view the page source.
s
well jolly good then. I'm pretty sure the (NFT) code I would use in a script is shorter and easier to understand and maintain than the equivalent workflow in all cases.
j
I’ve been told WFs are “optimised” to be faster, but I remain unconvinced.
in general I’m unconvinced that NetSuite understands how to optimise things….
s
I would be surprised if workflows generated code better than handwritten. It took decades for that to be the case in other languages.
m
Well this workflow action
message has been deleted
generates this code
Copy code
function workflow_fieldchanged(type, fldnam, linenum, column) {
if (fldnam =='shipdate') {AFTERFIELDEDIT10386001_169()}
}

function AFTERFIELDEDIT10386001_169() {
nlapiSetFieldValue('custbody_mos_shipdate', nlapiGetFieldValue('shipdate'));
}
p
@michoel I can't find it in the Source code. Please share more details. It sounds like a great tip.
s
interesting that it's generating SS1 code, perhaps that implies it may be slower than SS2 native? however, IIRC for client scripts at least, much of the SS2 api is actually just a abstraction around the SS1 api.
m
@Pavol you are only able to see the client side triggers (e.g. field changed)