1. Repeated use of scripts

    Article: AN0001893Updated:

    In certain cases we need to use a script in a repeated way, e.g. when we define logic of SLA calculation. In order that we do not need to define the logic several times and on the contrary we call a songle script defined in one place, we will use block of scripts. In our case we want to have function incident_target_time(), that we need to call from various places.

    We will create a block of scripts within the given model in which we define this function. In our example this block of scripts will have code sla_calculations. Each block can contain more functions that we want to use in various places of ObjectGears (buttons, workflow, rules etc.).

    We will than use following syntax in particular place (e.g. in a button):

    //#block sla_calculations

    function incident_target_time();

    The first line will cause adding block of scripts with code sla_calculations. The second line will execute function incident_target_time() defined in the block of scripts.