Is it possible to have multiple deployments of a U...
# suitescript
s
Is it possible to have multiple deployments of a UE script against the same record type? They would differ in the parameters.
n
Have you tried? Curious as to why you would use this approach though...
e
^ Yeah this seems strange; if it even works, it would mean the UE would always run multiple times for each record, which seems undesirable
s
Just trying to have a single script which can do similar yet different things depending on the parameters. Specific example, if a Sales Order originates from source x, add item y to it. The deployment would have x and y as parameter. I could then have another which would add item a if the source was b. Of course I could do it with one mote complex script, or have two instances if the script witg a deployment each. Not the end of the world but trying to be tidy!
n
Or you could have a module containing the rules and just maintain that. Wouldn't have to be complex could literally return JSON.
So in your case it could be the key is the source and the value is the item
a
and if you really just wanna use script params you could put your JSON in a script param 😄
🤭 1
n
^^ Not ideal if you want to reference the same info in other scripts just note 😉
a
I was actually thinking it maintains the data outside of code so non-dev could maintain it
but yeah situational for sure
n
Pff don't let those dirty users mess with things that can mess up logic would you! 😄 Arguably it's no more hardship to alter a file in the filecabinet if you know where it is 😉
a
lol I was thinking ADMINs rather than USERs, but yeah, you're not wrong
🍺 1
also code files might be in source control, script param values, wouldn't be
👍 1
s
In general, we try to have things accessible for non-coding Admins to maintain.
Folks who can create a Workflow, but not write Suitescript.
s
for situations like this, I may lean towards a “utility file” that could be JavaScript or JSON, and then have the script load it and use it to drive the behavior. that way you are at least decoupling the code from the configuration. Would still require editing the small utility file from time to time, but likely something an Admin with a good text editor can handle
m
How about a workflow action script deployed against the record, and then admins can call it with different parameters using workflows?
s
Interesting suggestions, thanks