]po[ Rule

A "rule" consists of a "condition" and an "action" part, each represented by TCL code. The condition is evaluated every time that an object modified or viewed by a user, or once per day. The action part is executed if the condition evaluated to "1" (representing a true value). The action part consists of a TCL command or optionally an email to be sent.

For details on how to use rules please see the Rule Engine package.


Fields of the im_rules Table:

  • Object Type (varchar references acs_object_types):
    The object type for which the rule will be executed. Please note that project, timesheet task and ticket are treated separately.
  • Status (rule_status_id:integer references im_categories):
    May be "active" or "inactive". Only active rules are executed.
  • Type (rule_type_id: integer references im_categories):
    Currently not used.
  • Name (rule_name:text):
    Human readable name for the rule.
  • Sort Order (rule_sort_order:integer):
    Defines the order of execution of rules per object.
  • Description (rule_description:text):
    Human readable description of what the rule does.
  • Condition TCL (rule_condition_tcl:text not null):
    A TCL expression that returns 0 or 1. Please see the Rule Engine package documentation for details.
  • Action TCL (rule_action_tcl:text):
    A TCL command. Please see the Rule Engine package documentation for details.
  • Email To TCL (rule_action_email_to_tcl):
    A TCL expression returning a list of emails. Please see the Rule Engine package documentation for details.
  • Email Subject (rule_action_email_subject:text):
    The subject line for the email. Please see the Rule Engine package documentation for details.
  • Email Body (rule_action_email_body:text):
    The email body. Please see the Rule Engine package documentation for details.

 

Data-Model

Structure of the im_rules database table:


create table im_rules (
                                        -- The object_id: references acs_objects.object_id.
                                        -- So we can lookup object metadata such as creation_date,
                                        -- object_type etc in acs_objects.
        rule_id                         integer
                                        constraint im_rule_id_pk
                                        primary key
                                        constraint im_rule_id_fk
                                        references acs_objects,
                                        -- Short name of rule
        rule_object_type                varchar(100)
                                        constraint im_rule_object_type_nn
                                        not null
                                        constraint im_rule_object_type_fk
                                        references acs_object_types,
                                        -- Every ]po[ object should have a "status_id" to control
                                        -- its lifecycle. Status_id reference im_categories, where
                                        -- you can define the list of stati for this object type.
        rule_status_id                  integer
                                        constraint im_rule_status_nn
                                        not null
                                        constraint im_rule_status_fk
                                        references im_categories,
                                        -- Every ]po[ object should have a "type_id" to allow creating
                                        -- sub-types of the object. Type_id references im_categories
                                        -- where you can define the list of subtypes per object type.
        rule_type_id                    integer
                                        constraint im_rule_type_nn
                                        not null
                                        constraint im_rule_type_fk
                                        references im_categories,
                                        -- Short name of rule
        rule_name                       text
                                        constraint im_rule_rule_nn
                                        not null,
        rule_sort_order                 integer
                                        default(0),
                                        -- Description for rule
        rule_description                text,
                                        -- Condition = Left Hand Side of the rule - a TCL expression returning 0 or 1
        rule_condition_tcl              text
                                        constraint im_rule_rule_nn
                                        not null,
                                        -- TCL expression for action = right hand side
        rule_action_tcl                 text,
                                        -- TCL expression returning a list of email addresses
        rule_action_email_to_tcl        text,
                                        -- Text with %varname% substitution
        rule_action_email_subject       text,
                                        -- Text with %varname% substitution
        rule_action_email_body          text
                                        -- There may be additional fields for actions to be performed on rule firing
);

Related 

  • For details on how to use rules please see the Rule Engine package. 


  Contact Us
  Project Open Business Solutions S.L.

Calle Aprestadora 19, 12o-2a

08902 Hospitalet de Llobregat (Barcelona)

Spain

 Tel Europe: +34 609 953 751
 Tel US: +1 415 200 2465
 Mail: info@project-open.com