×

Please give details of the problem

Docs

Find

    Developer Guide

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

    Scripted Lanes


    IMPORTANT - Advance Notice of upcoming API deprecation

    The performance of scripted lanes was drastically improved with the release of thibault_v1 (November 2016). This enhancement required a new set of script definitions and some previously supported functionality has been deprecated, full details are given in this document.

    Currently RunMyProcess accepts all scripts. The ones that are compliant with the new definition will take advantage of the new mechanism while the non-compliant ones will continue to use the old mechanism. A check is provided to help you determine whether your scripts are compliant or not.

    We strongly advise that you check that your scripted lanes are compliant with the new definitions. If your lanes are found to be non-compliant they will need to be re-written before the old mechanism is deprecated. While both mechanisms are currently supported, we strongly advise that you upgrade your scripts to the new definition at your earliest convenience - both to take advantage of the improved performance and to prepare for the deprecation of the old mechanism.

    When will the old mechanism be deprecated?

    We aim to deprecate the old method at the beginning of July 2017.

    A reminder will be sent out before each release.

    What is the impact on my scripted lane if it is not compliant with the new algorithm?

    Once we have deprecated the old mechanism, non-compliant scripted lanes will be empty.

    As a consequence, some end-users that were members of these non-compliant scripted lanes might not be able to access their applications or part of their applications.

    How will I know which scripted lanes are non-compliant?

    To review the status of your lanes, please follow these steps:

    1. Open the IDE (https://portal.runmyprocess.com/ide/).
    2. Open the Toolbox / Organization tab.
    3. A new column "Syntax" has been added (Please note that you cannot filter on this column therefore it is important that you check each available page).

    ScriptedLaneSyntax

    This column can take three values:

    Value Explanation
    An empty column means that the lane is not a scripted one. No action is required.
    Valid The lane is compliant. No action is required
    Invalid The lane is non-compliant. You will need to update the script.

    How can I make my scripted lanes compliant?

    Warning: Scripts are common to each of the three environments (TEST, ACCEPTANCE and LIVE). If you therefore update your script and save it, it will be applied directly to the LIVE environment.

    We recommend the following process for upgrading your scripts:

    1. Create a new temporary scripted lane;
    2. Open the non-compliant scripted lane and copy the script;
    3. Paste the script into the temporary scripted lane;
    4. Update the script according to the documentation below and click on the Check Script button;
    5. Once you have checked the script is valid, copy the upgraded script and paste it into the original non-compliant scripted lane;
    6. If you are having trouble upgrading your scripts, please do not hesitate to contact our support (http://support.runmyprocess.com/) or get in touch with your usual contact.

    Please note that your non-compliant scripted lanes will continue to work until the old mechanism is fully deprecated (July 2017).


    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 metadata, preferences or current lane membership (or a combination of the three). This document gives details of what can be included in a script.

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

    1. Modification of the script for the lane;
    2. Modification of a user's metadata;
    3. Modification of a user's preference;
    4. Modification of one lane referenced in the 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.

    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