JavaScript

automator-logo

During our first automator steps we introduced a “JavaScript – like” language to script automation packages. This was a necessity because of our execution engine back then.

After a year of automator experience we decided to adapt a different by far more powerful execution engine and pure JavaScript in its version V2016.

javascript-automator

What does it mean from a business perspective?

  • Every JavaScript developer can write automation scripts after a short introduction.
  • If you decide to cancel your automator subscription, you can simply take the automation scripts and use them in your own environment. Only small parts have to be added by your JavaScript developer.

What does it mean in technical terms?

JavaScript developers can make use of the following possibilities:

  •  Base language features
    -> Variable declaration with var, let, const
    -> if and else with {} Blocks
    -> let x={}; Blocks to create new data objects
    -> for, for of, break
    -> while, do.. while
    -> switch
    -> regex
    -> template Strings
    -> Block and line comments
    -> functions (named, anonymous, self calling, nested)
  • Base functions like
    -> isFinite, isNaN
    -> parseFloat, parseInt
    -> decodeURI, decodeURIComponent
    -> encodeURI, encodeURIComponent
  • Base objects like
    -> Math, Number, Date
    -> Infinity, NaN, undefined
    -> true, false
  • Standard Operators like
    -> Logical Operators (==, !=, <, >, <=, >=, ===, !==, ||, &&)
    -> Math. Operators (+, -, *, /, %)
    -> Ternary Operator (condition?then:else)
  • Default set of functions:
    -> stringify and parse – for JSON handling
    -> log, logError, logVerbose an logDebug
    -> date and moment – to create a Date and Moment object
    -> newMap and newSet() to create the Map and Set Objects
    -> setProperty and getProperty to access a property by its name
    -> isNull, isArray, checkNull
    -> uuid, atob,btoa, encodeHTML, decodeHTML
    -> formatdate, formatDateTime, formatNumber, …
  • HTTP, REST, GRAPH, MAIL, Proxy functions
    -> http functions that can be used e.g. for SLACK integration
    -> rest functions can be used e.g. for JIRA integration
    -> graph functions can be used for Office 365 & Sharepoint integrations
    -> proxy functions that can execute powershell scripts on premise
    -> In detail:
    -> http_get, http_post, http_put, http_patch, query_stringify
    -> rest_get, rest_post, rest_put, rest_patch
    -> graph_get, graph_post for office 365 access
    -> sendMail
    -> executeOnProxy
  • ITRP functions
    -> fetch, fetchAll, fetchFilter
    -> update, create, deleteItrp for Itrp Accounts
    -> addNote, addApprover, link, mergeAudit
    -> isUserTokenValidInAccount, hasUserTokenRoleInAccount
    -> exportPromise, importPromise, waitForPromise
  • Template Management
    -> templates now support the smart {{variable}} style
    -> templates allow ASP style development (<%=variable%> and <% /* code */ %>)
    -> templates can only access global package variables
    -> text in variables can be used as template now
    -> in detail:
    -> createTemplateTextMail, createTemplateHTMLMail, createTemplateText
    -> textFromTemplate, subjectFromTemplate,
    -> bodyFromTemplate, bodyFromTemplateText
    -> useContentAsTemplate
  • NOT implemented
    -) Use of classes, and therefore no use of the “new” keyword
    -) Asynchronos calls or use of functions – all is handled synchrone
    -) continue is not allowed in loops
    -) All elements that are not listed above

Conclusion

Every JavaScript developer is now able to develop automation packages within the automator framework. Workflow automation is now easier than ever.

k.konwalin@techwork.at

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s