1、Advanced Automation Script TechniquesJason VenHuizenCPO-Naviam1173Automation Scripts are Customizations2 General conventions and techniques Defining custom objects in JavaScript and Python Passing functions as arguments Importing scripts and reusing libraries Implementing custom Java classes Demonst
2、ration:Implementing server sent events.3IntroductionGeneral Conventions and Techniques Use a main()function to enter the script.Provides a clear execution path Allows global runtime checks Allows code to return Avoids extensive if-then-else logic JavaScript Python5Use a main()Function Do not assume
3、the script was called from an expected event Ensure expected implicit variables are present mbo is not present in all contexts Use present variables to inform context,for example runAsUserInfo is only available for script CrontTasks Check that implicit variables are as expected Validate the mbo type
4、 Validate args are correct Attribute name available for attribute launch points,e.g.wonum6Validate Context and InputsValidate Context and Input Example7JavaScriptPython Configure format on save Ensures clean diffs Consistent formatting between developers Define and enforce corporate linters to avoid
5、 common mistakes Recommended VS Code formatters Prettier for JavaScript Black Formatter from Microsoft for Python8Format on Save File header change logs are for when you dont have source control and arent using VS Code Developer Tools This is pointless:9Stop Using File Header Change LogsDefining Obj
6、ects in JavaScript and PythonServer Sent Event Object11Java ScriptPythonPassing Functions as ArgumentsPass Function as Argument13Java ScriptPythonImporting Scripts and Reusing LibrariesInline a Library Script Source15Java ScriptPythonImplem