×

Please give details of the problem

Docs

Find

    Developer Guide

      1. Todo Validation
    1. Release Your User Login
    1. Markdown Template
      1. Backloop
      2. JavaScript Inclusion
      3. Task Reminder Email
      4. Variable Mapping
      5. SubProcess
      6. PDF
    2. Trigger
      1. Lock
      2. Dynamic Variable
      3. List 1000+ Objects
      4. JSONObject Creation
      5. JSONArray Conversion
      6. Number Currency Format
      7. Error Handling
      8. JSONObject Concatenation
      9. Freemarker Container Test
      10. Number Test
      11. Loop
      12. File Visibility
      13. List Hash Sequence
      14. Special Freemarker Characters
      15. Array To List
      16. Salesforce Computation
      17. Metadata
      18. JSONObject Keys Values
    1. Delegation
    2. Access Rights
    3. Dynamic Lanes
    4. Runtime Lanes
    5. Scripted Lanes
    6. Compound Organization Hierarchy
      1. Array From WS
      2. Column Inactivation
      3. Holidays
      4. List Reinitialization
      5. ArrayJSON to JSONArray
      6. Print JSONObject
      7. Invalid Fields
      8. Number Currency Format
      9. Google Tables
      10. Initialization Widget Date
      11. Date
      12. JQuery
      13. Round
      14. Inject JSONObject
      15. Label Modification
      16. Launch Process JQuery
      1. CSS Personalization
      2. CSS Examples
      1. Tags
      2. Retrieving Variables Values
      3. Dialog Window
      4. Autocomplete Widget
      5. JavaScript Report
      6. User Lane Picker
        1. Chart Dashboard Collection
        2. Chart Dashboard
        3. Report Chart
        4. Google Visualization
      7. Collection
      8. Dynamic List
      9. Summing Array
      10. API Listener
      11. File Preview
    1. Performance
      1. Custom Login Page
      2. Redirection ExecutionMode
      3. Mobile Devices
        1. homepage.js
        2. homepage.css
      4. Logout
      5. Header
      6. Menu Bar
      7. Information Tags
      8. Basket
    1. Mobile
    2. Offline
        1. Collections
          1. Process General Tab
            1. Process Step Output Variables
              1. Process Task Email Tab
              2. Process Task SubProcess Tab
              3. Process Task Functional Tab
              4. Process Task Connector Tab
              5. Process Task Manual Tab
              6. Process Task Loop Tab
              7. Process Task Script Tab
            2. Process Step Input Variables
            3. Gate
            4. Process Step Testing Variables
              1. Process Intermediary Event
              2. Process Timer Event
              3. Process Start Event
          2. Process Variables Tab
          3. Process Measures Tab
          4. Process Design
          5. Process Input Tab
          1. Organization
          2. Roles entities
          1. Project Collection Tab
          2. Project Definition Tab
          3. Version
          4. Project Versioned Files Tab
          5. Project Files Tab
          6. Project Description Tab
          7. Project Version Tab
          8. Project Rights Tab
          1. Connectors
          2. Providers
          3. Processes
          1. Composite API Configuration Tab
          2. Composite API Design Tab
        2. Custom Lists
        3. Revision
            1. Image Widget
            2. Spinner Widget
            3. FileUpload Widget
            4. Section Widget
            5. Multi Checkbox Widget
            6. URLInput Widget
            7. RadioButton Widget
            8. Array Widget
            9. Captcha Widget
            10. Checkbox Widget
            11. Report Widget
            12. Geolocation Widget
            13. Button Widget
            14. Custom Widget
            15. TextInput Widget
            16. Tree Widget
            17. List Widget
            18. StaticText Widget
            19. HTML Editor Widget
            20. JavaScript Widget
            21. Tab Widget
            22. HTML Widget
            23. ProgressBar Widget
            24. History Widget
          1. Web Interface Stylesheet Tab
          2. Web Interface Design Tab
          3. Web Interface Analytics Tab
          4. Web Interface Collection Tab
          5. Web Interface API Tab
          6. Web Interface Implementation Tab
          7. Web Interface JS Tab
        1. Scheduled Process
        2. Messages
        1. Configuration
        2. Users
        3. Usage
        1. Connectors
        2. Process Examples
      1. Customer Management
          1. Measuring
          2. Parameters
          3. Execution Path
          4. Runtime Users
        1. Web Interface Reports
        1. Files
        2. Home
        3. My Applications
      1. Collections To Array
      2. Collections BackOffice
      3. Collection JS Freemarker
      4. Collections To List
      1. Composite API Example
      1. Process Reporting API

    Scripted Lanes

    1 Overview

    A user will be a member of a Scripted Lane if they satisfy the criteria set for membership by the script which defines how membership should be determined. The criteria can be based on the user's settings, metadata, preferences or current lane membership (or a combination of the three). This document gives details of what can be included in a script.

    info_1 The script is relevant for execution modes LIVE and ACCEPTANCE

    info_2 Once you have created your script it is possible to check it. The result will show you how many users meet the criteria (and so will be members of the lane) and the duration of the query.

    info_3 Lanes and Roles are essentially the same things. Roles are used in a User context whereas Lanes are used in a Process context i.e. a Role becomes a Lane in a process context.

    1.1 Script computation

    Membership of a scripted lane is re-computed under the following circumstances:

    1. Modification of the script for the lane;
    2. Modification of a user's settings;
    3. Modification of a user's metadata;
    4. Modification of a user's preference;
    5. Modification of one lane referenced in the script.

    Only impacted scripted roles (because of a script change or user metadata / preference / settings update) are computed.

    Scripts are computed in batch: Therefore it could take up to maximum 5 minutes before being computed.

    info_4 When a script is computed, all the users matching the script become part of the role.

    1.2 Status and last computed date

    The status and last computed date of the scripted role are displayed in the Role Management module of the DigitalSuite within the Information section.

    The status could be one of the following value:

    • Ready: The role has been computed properly and is up to date.

    • Pending: Something impacting that specific role has changed (script, user metadata, preference or settings) and the role is waiting for its computation.

    • Error: The role cannot be computed. In this case, contact our support team.

    • Invalid script: The script is invalid (all invalid scripts will result in an empty lane). In this case, update the script to be compliant with the new syntax.

    2 Creating a Scripted Lane

    Go to the tab Organization and create a new Role. By adding a formula within the Role Script field your lane will become a scripted lane.

    A scripted lane is created separately to the process execution, scripts can only therefore involve static data.

    The supported structure of a script is (in the following order) :

    • An optional static part

    • A dynamic part

    2.1 Optional Static part

    <# freemarker static computation >

    Here is an example script:

    1
    2
    3
    4
    <#-- Computation of the ratio -->
    <#assign first_number = 23>
    <#assign second_number = 3>
    <#assign result = first_number / second_number>
    

    The result could be used as a variable of the dynamic part (to ease the understanding of a computation for example).

    2.2 Dynamic part

    ${ expression }

    Rules for the expression:

    • Expression could be a combination of logical parts separated by && or ||

    • Supported evaluation order is variable operator value (value operator variable is not supported)

    • Only the listed Properties and FreeMarker Methods or Built-ins are supported

    Here are some example scripts:

    • ${is_user_in_lane([1111,1112,1113])} : The scripted lane will contain all the users that belong to any of the lanes 1111, 1112 or 1113. In other words, the scripted lane will be the union of the lanes 1111, 1112 and 1113.

    • ${is_user_in_lane([1111]) && is_user_in_lane([1112])} : The scripted lane will contain the users that belong to both lanes - 1111 and 1112. In other words, the scripted lane will be the intersection of the lanes 1111 and 1112.

    • ${is_user_in_lane([1111]) && color=='red'} : The scripted lane will contain all of the users that belong to the lane 1111 and have the Metadata or Preference 'color' set to red.

    info_1 If the script is not recognised as a script e.g. because it does not start with ${ and end with } or start with <# then the lane will be empty.

    3 Valid Methods and Properties

    The following section details the methods and properties that can be used within scripts.

    3.1 Freemarker Methods

    • is_user_in_lane(): Allows you to determine whether or not the current user is a member of at least one of the lanes specified. The lane ids are passed as a list (can be just one lane).

    • get_user_metadata(): Get the metadata for the current user.

    • get_user_preferences(): Get the preferences for the current user.

    • get_user_data(): Get the basic data (e.g. id, name) for the current user.

    • has_right(): Determines if the current user is a member of the lane whose id is passed as a parameter.

    info_1 If the lane queried by methods is_user_in_lane() and has_right() is a lane of type everybody, an error will be thrown. These methods should not be used with lanes of type everybody.

    3.2 Using Internal Parameter P_user

    P_user can be used in the script to represent the current user.

    3.2.2 User Properties

    The following properties can be used with P_user to access the user's data:

    Property Description Syntax
    id The user's unique identifier P_user.id
    login The user's login id P_user.login
    name The user's name P_user.name
    profile The user's profile P_user.profile
    status The user's current status - Active, Pending or Inactive P_user.status
    restriction Any restriction placed on the user's account e.g. unable to view other users P_user.restriction

    3.2.1 Metadata and Preferences properties

    The following properties can be used with P_user to access the user's metadata or preferences:

    Property Description Syntax
    extended Access the current user's metadata P_user.extended.xxx where xxx would be the name of the metadata required (e.g. P_user.extended.company).
    Equivalent of using get_user_metadata() or get_user_data().extended
    preferences Access the current user's preferences P_user.preferences.xxx where xxx would be the name of the preference required (e.g. P_user.preferences.language).
    Equivalent of using get_user_preferences() or get_user_data().preferences

    3.2.3 Accessing properties direclty

    It is possible to access properties directly within the script e.g. ${my_metadata == value} In this case, if the property is present in both the metadata and the preferences, the metadata will take preference.

    3.3 Freemarker Built-ins

    The following Freemarker Built-ins can be used within scripts:

    Built-in Description Example
    ?? This operator determines if a value is missing (result is false) or not (result is true).
    If the metadata doest not exist, ?? will raise an error
    P_user.ext.company??
    ?default This allows you to set a default value if the value is missing. P_user.ext.company?default("MyCompany")
    ?exists This operator determines if a value is present (result is true) or missing (result is false).
    If the metadata doest not exist, ?exists will raise an error
    P_user.ext.company?exists
    ?contains True if the substring specified as the parameter to this built-in occurs in the string. P_user.login?contains(".fr")
    ?seq_contains() True if a sequence contains the value passed as a parameter. get_user_preferences().languages?seq_contains("Russian")
    ?size The number of elements in a sequence languages?size

    info_1 Consecutive Freemarker Built-ins are not supported (Ex: P_user.pref.language?default("English")?contains("Russian")

    4 Deprecated Freemarker Built-ins

    Some Freemarker Built-ins that were previously supported in scripts have now been deprecated. This section identifies these built-ins and suggests alternative ways of achieving the same behaviour with supported Built-ins.

    Built-in(s) Explanation Example Previous Use Replacement
    ?eval This built-in evaluates a string as an expression. For example "2+2"?eval returns 4. ${language == "English"?eval} ${language == "English"}
    ?default([])?size Consecutive Freemarker Built-ins are not supported. ${(companies?default([])?size > 0)} ${(companies?size > 0)}
    ?index_of This built-in was used to determine the presence of a substring within a string. ${grade?index_of("y") != -1} ${grade?contains("y") == true}
    ?upper_case This built-in converted a string to upper case. ${(country?upper_case == "ENGLAND")} No alternative available yet
    ?lower_case This built-in converted a string to lower case. ${(country?lower_case == "england")} No alternative available yet
    ?string This built-in returned the value as a string. ${global_superuser?string =="true"} (if global_superuser is a boolean) ${global_superuser == true}
    ?has_content This returned true if the variable existed and had some value. ${get_user_metadata().finance?has_content} ${get_user_metadata().finance?? && get_user_metadata().finance != ""}

    5 Other deprecated functionality

    Strings used as booleans

    It was previously possible to treat strings that were used for boolean values as though they were booleans e.g. ${support} where support was a string used for boolean values (i.e. took the value "true" or "false").

    When no operators are used on these strings, they must now be treated as strings rather than booleans. The above example would therefore need to be written as ${support == "true"}

    6 Error Codes

    The following errors codes are the answer of the server when checking or saving a scripted lane :

    Code Name Explanation
    FMT0 MALFORMED_SCRIPT No script or assignment block found.
    FMT1 UNKNOWN_PROPERTY_EXCEPTION The property(metadata or preferences) is unknown
    FMT2 SYNTAX_ERROR_EXCEPTION Syntax problem - an expected character was not found
    FMT3 NO_SCRIPT_EXCEPTION The script was not recognized, the ${} was probably missing
    FMT4 INTERNAL_EXCEPTION An exception was thrown during the translation of the script
    FMT5 BUILTINS_EXCEPTION At least one unsupported built-in was used
    FMT6 EVERY_BODY_LANE_EXCEPTION The script used at least one everybody lane
    FMT7 SEQ_CONTAINS_EXCEPTION The parameter passed to built-in ?seq_contains() is incorrect
    FMT8 SYNTAX_OPERATOR_EXCEPTION A syntax problem was found around an operator (e.g. a single '&' instead of a double '&&')
    FMT9 PARENTHESIS_EXCEPTION A parenthesis mismatch, no closing parenthesis found for an opening one
    FMT10 UNKNOWN_DATA_EXCEPTION The data(metadata or preferences) is unknown
    FMT11 NOT_SYNTAX_EXCEPTION Syntax problem around the use of the NOT ('!') operator
    FMT12 UNKNOWN_OPERATOR_EXCEPTION The operator used is not a supported one
    FMT13 BUILTINS_SIZE_EXCEPTION The value of the ?size built-in was not found
    FMT14 WRONG_SIZE_VALUE_EXCEPTION The size value is not compatible with ?size built_in
    FMT15 UNKNOWN_SIZE_OPERATOR_EXCEPTION The operator of the ?size built-ins is not supported
    FMT16 TYPE_EXCEPTION Wrong or malformed parameter of builtins ?contains
    FMT17 DOUBLE_BUILTINS Consecutive builtins
    FMT999 OTHER_EXCEPTION An unknow exception was thrown during the testing of the script