Docs
  • Getting Started
  • Overview
    • Understanding
      • User-Interface
      • Shortcuts
    • Getting Started
      • Creating A New Application
      • Adding Basic Structure using Class Designer
      • Creating a link to the TIVITY File Class
      • Setting Rights
      • Creating Queries
      • Building The Layout
        • Creating an App Page
        • Creating an Object Page
        • Creating a List Item Layout
  • Building an Application
    • Application Setup
      • General
      • Documentation
      • License Management
      • Publishing the Application
      • Advanced Settings
        • Document-MailEditor
    • Data
      • Sources
      • Data Modelling
        • Class
        • Field
        • Action
        • Link
      • Query Data
        • Get Started with Query Designer
        • Common
        • Fields
        • Conditions
        • Default Values
        • Preview
      • Roles & Permissions
        • Rights Designer
      • Access Control Lists (ACL)
    • Views
      • Design UI
        • Page Types
        • Fields and Links
        • Layout Controls
          • Actions
          • Panels
          • Sections
          • Lists
          • Input
        • Layout Templates
      • Document Templates
        • Get started with Template Designer
        • Expressions in Templates
    • Execution
      • Functions
      • Workflows
        • Control Types
      • Trigger
      • Scripting
        • Accessing the Script Designer
        • Using the Script Designer
        • Commonly used Actions
        • Reference: Actions
          • Math
          • System
          • Date
          • Collection
          • LogicalOperators
          • Web
          • Structure
          • Constants
          • Converters
          • Commands
          • Text
          • PDF
          • Operators
          • PowerPoint
          • QR-/Barcode
          • Messaging
          • Cells
          • Xml
          • Admin
          • Integrations
    • Expressions
      • Expressions in Expressions
      • Expressions in Condition Values
  • Administration
    • Platform
    • Workspace
    • Security
    • Platform Setup
  • Extensibility and Integration
    • REST API
    • Source Adapter
      • Getting Started
      • Source Adapter Interface
      • RESTful Adapter Service
  • Adapter Portfolio
    • MongoDB Adapter
  • Platform Features
    • Enterprise Search
      • Integration into an App
      • General Settings
    • Templates
    • Tagging
      • Getting Started
      • Manage Tags
      • Settings
      • Usage
        • Tag filter
        • Tag panel
    • DMS Setup
Powered by GitBook
On this page
  • Block
  • Variables
  • Example 1: Create a variable and assign a constant value
  • Example 2: Create a variable and assign an object
  • Example 3: Reference a variable
  • GetCurrentUser
  • Working with Values
  • GetValue
  • SetValue
  • GetSystemName
  • GetSystemId

Was this helpful?

  1. Building an Application
  2. Execution
  3. Scripting

Commonly used Actions

Actions are the backbone of the scripting capability in the TIVITY platform. This article lists and described a few commonly used Actions and provides examples of use.

PreviousUsing the Script DesignerNextReference: Actions

Last updated 2 years ago

Was this helpful?

Block

The Block action allows the grouping of elements in logical units. It is usually used to assign a list of the same operation to a higher-level unit.

Variables

Variables are commonly used to handle flexible script execution. A variable can be defined as a constant value or might hold the return of a called function. During script execution variables can be used in other actions.

Example 1: Create a variable and assign a constant value

In the Scripting Area click into the Drop statement here block and enter variable in the appearing search box. The Action menu is going to show you the Variable action. Select the Action to add it to the script.

Next, enter a Name for the newly created statement, e.g. FY2021Begin to indicate the begin of the financial year 2020/21. That name value is going to be listed in the Variables Menu and allows easy reference and use at a later stage in the script.

Then click into the Expression (Any) area to specify the data type of the variable, e.g. DateTime. The search feature assists you to find and choose the data type.

Last, provide a value for the variable to complete the statement, e.g. 01.07.2020.

The newly created variable appears in the Variable Menu on the right-hand side of the Script Designer as soon as the data type in the Expression field has been specified. The variable can be used for other operations in the script.

Example 2: Create a variable and assign an object

In the Scripting Area click into the Drop statement here block and enter variable in the appearing search box. The Action menu is going to show you the Variable action. Select the Action to add it to the script.

Next, enter a Name for the newly created statement, e.g. Context to indicate the runtime context of the script. The variable is going to be listed in the Variables Menu and allows easy reference and use at a later stage in the script.

Then click into the Expression (Any) area and enter getinstance in the appearing search box. The result list is going to show you the GetInstance action which has a return type of Object. The GetInstance action is normally used in an instance workflow. As a reminder: “An instance workflow is a workflow that is called-up for a specific object.” The “Context” part refers to this object.

Finally, drag and drop the corresponding, built-in variables from the Variables Menu into the properties of the GetInstance expression to complete the newly created variable.

An Object returned by GetInstance action is identified by the following fields.

Property

Description

OfficeId (Guid)

Indicates the ID of the workspace in which the application is located and for which a workflow is created.

ApplicationId (Guid)

Indicates the ID of the application located in the selected workspace.

ClassId (Guid)

Indicates the ID of the class that identifies the object.

InstanceId (Any)

Each object has a unique ID. To reference a specific object, the specific ID can be entered here.

LinkPath (LinkPath)

The LinkPath is the navigation path to an object. It describes the steps that led to the object.

Example 3: Reference a variable

After creating variables and assigning values or objects to them, it is time to work with those variables. To illustrate this, take the subtraction of two numbers.

Then add the Subtract action to the script and drag the two variables from the Variables Menu on the right-hand side to the desired place in the statement.

The choice of Get or Set operation defines how the value of a variable is used in a script (see green boxes above).

GetCurrentUser

Many scripts require information from the user who initiated the script, i.e within a workflow. In order to interact with the user on the TIVITY platform get the user object using the GetCurrentUser action and save it in a variable called User.

A user is uniquely identified by an office. Therefore select the Context.OfficeId variable from the Variables Menu.

Now, it is possible to work with the user object just like with any other object and, i.e. use the GetValue action to read out a user’s ID.

Working with Values

Compared to variables Values are associated with an object. The two actions GetValue and SetValue allow you to read a field of an object and to define a new value for a field.

GetValue

The GetValue action allows to read a value from a field of an object. The action has two parameters. Object (Object) identifies the object from which the value is to be read. Field (String) is the property of the object which holds the value. The terms in parentheses indicate the expected data type.

The example above uses the GetValue action from the Actions Menu. Then, drag the “Object” object previously defined from the Variables Menu into the Get Variable area. Next, enter the word “Id” in the text box next or under Field.

Field is case-sensitive, i.e. upper case and lower case are important here.

SetValue

In comparison the SetValue action allows values to be set in a field of an object. The two parameters Object and Field are equivalent to the GetValue action. The third parameter Value is the actual value to be stored in the field.

In the example above you get a reference of an Object of type Note using a variable. Next, the script is going to update the Field Description with the information provided in the Value expression.

This example was greatly simplified. In a real scenario, the user should be able to enter a value on the UI, and the script should represent the logic to store this value.

GetSystemName

The example shows how to set a value to a variable Note of type Object. It uses the GetSystemName action to reference the field Description of an object (here: Unit).

GetSystemId

Just as with the GetSystemName action, the GetSystemId action allows you to fetch the Ids. A list of available classes, fields, actions, workflows etc. can be used to search for a specific name. If you don't know the name, you can also search for the type, e.g. with the search word 'class' all classes are listed. In addition, if you enter e.g. 'controller', all controllers will be listed.

Available ID lists

  • Class

  • Field

  • Action

  • Workflow

  • Layout

  • Query

  • Script

  • Template

  • Function

  • Link

  • LinkServiceType

  • Controller

  • Group

  • Office

  • Feature

The example above has a Block element in which variables are assigned and another Block element in which operations are performed with those variables. See also for more explanation.

First define two variables Number 1 and Number 2 as described in .

Field denotes the field of an object. This means that it is possible to look up the key of a field in an object in the class designer. An alternative way to access a Field is described under .

In order to be able to set a value to an object you need to hold a reference to it. The action GetInstance provides you access to such an object reference, as described in .

The GetSystemName action allows you to look up the names of fields of a class directly in the Script Designer. This eliminates the need to go into the just to look up the name of a field.

Class Designer
Example 1: Create a variable
GetSystemName
Example 2: Create a variable and assign an object
Architecture of a Script
Use of Block statements to separate a script into logical units
Create a constant variable in the Script Designer
Create a variable using the GetInstance action in the Script Designer
Get values of variables in an action
Get the current user and store it in a variable
Read the Field (Id) of an object
Set or update the value in a field (Description) of an object (Note)
Use GetSystemName to reference a field and set a new value
Script helper GetSystemId