Scripting¶
Emakin incorporates a scripting environment that enables the creation of custom scripts to automate tasks, extend system functionalities, and facilitate integrations with external systems.
Scripting Environment¶
See Script Contexts for the objects, XML scopes and return contracts of each execution surface, and Script Execution Order for when each workflow surface runs.
The following guides cover common server script tasks:
- Working with Process Data: reading and changing values, repeating rows and data checks
- Reading and Saving Table Data: queries, expressions, filters and batch saves
- Calling REST Services: requests, authentication, status codes and files
- Error Handling and Transactions: failures, rollback and repeat-safe external calls
- Generating Documents: PDF and Word files from templates and data
- Using Script Modules: shared functions for workflow scripts, forms and external systems
- Debugging Scripts: diagnostic output, job logs, traces and test mode
- Security in Scripts: permission checks, credentials and untrusted input
- Electronic Signatures: signing and verifying files
The scripting environment is predicated on the JavaScript programming language. JavaScript is a widely adopted language, and within Emakin, it is isolated from the underlying operating system to ensure a secure and stable execution environment.
The script execution runtime may vary depending on the script type, with scripts executing in either a server-side environment or a client-side browser environment. Further details on the specific runtime environment are provided in the documentation for each script type.
Use this section when you need reusable automation or extension logic. The generated reference/ subtree remains the source for object-level API details.
Document Automation¶
See Document Management for identities, lifecycle, files, profiles, authorization, and complete publication examples.
Scripting Reference¶
Environment¶
$ActiveUser
Active user as Identity
$Culture
Current culture information (e.g. en-US, tr-TR)
$Initiator
Initiator user as Identity
$Priority
Current priority (0-5) information
$TestMode
True when process in test mode
$Domain
Current domain information
Data Access¶
$Xml
Process data manipulation
$Database
Relational database access
$Documents
Document management
$Files
File archive
$ActivityStream
Object activity stream
$XmlRepository
No-SQL xml database
Organization Data¶
$Membership
Organization data like users, groups.
$Delegation
Delegations between users
Processes¶
$Case
Current case instance
$WorkItem
Current work item instance
$Instance
Current workflow instance
Date and Time¶
DateTimeOffset
Timezone aware date and time
$Calendar
Rule based date time operations
Integration¶
$Messages
e-Mail sending and mime message parser
$Rest
Rest API client
$Services
SOAP API client
Utilities¶
$Templates
Template renderer
$Decisions
Business rule engine
$Cache
Distributed cache database access
$AI
Calls to configured AI providers
Script Example¶
The following server script fills the placeholders of a Word template and stores the result as a new file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
The template file is not changed. See Writer for creating documents, tables and PDF output.