There two types of conditions in use in appRules.  The first is the condition required to control the flow of your workflow.  These conditions are required by workflow activities such as While, If, and Switch to control the flow of your workflow. 


The second type of condition is used by in general by the appRules system.  The system allows you to use conditions extensively to add flexibility to your processes.  For example when defining filters for selecting data from a source, you can use a condition to decide whether to include a filter item or not.  Another example involves field maps – which allows you to use a condition to decide whether to map a data field or not. 


In addition to the conditions that you define, appRules also includes several built-in conditions that you can select on demand.


Control Flow Conditions


Control flow conditions are mostly defined on the Designer.  To define a condition for a control flow activity (e.g. While), drag the control flow activity on to the designer.




You can select and/or define the condition associated by using one of the condition type available, the while will iterate until the related condition is set to false.




Last Result is True     The result of the previous activity in the flow (for example if it is an InitializeSource activity, it stays True until all the records are read) This activity needs to remain next to the while.    
Specific Activity Result is True     The result of a previous activity (selected from the project’s activities list) in the flow Must be of course executed before the while in the flow    
Condition Activity is True     The result of a previous Condition activity in the flow (see Condition activity in the Business Rules module) Must be of course executed before the while in the flow    
Condition Expression is True
Condition Function is True
Condition Script is True  
    See below      
Counter Equal To
Counter Less Than
Counter Less Than or Equal To
Counter Greater Than
Counter Greater Than or Equal To  
    Indicate a value, a counter variable is defined in the Project Details and can be iterated anywhere in the flow        





Javascript Editor (Expressions and Scripts)


The JavaScript Editor allows you to extend your appRules Portal project using JavaScript.

In appRules Portal, you can use the JavaScript Editor to define expressions, condition expressions, scripts and condition scripts.


An expression is simply a single line of JavaScript code, while a script is made up of one or more lines of JavaScript statements. Depending on your usage requirements, a key benefit of using scripts is that they are automatically compiled and provide high performance execution, while expressions are interpreted.


appRules Portal exposes several methods (functions), that you can call directly from your JavaScript expression or script. These methods give you access to values in your workflow and are shown at the bottom of the JavaScript Editor window. To include a method in your expression or script, double-click on the row.





The appRules Portal methods are exposed in the object ‘app’. For example, the following statement gets the first name of a contact in a data source:

app.GetDataFieldValue(“ContactSource”, “Contact.FirstName”) .

In addition, .NET System.Core methods are also exposed in the object ‘sys’. For example, the following statement gets the current date/time: sys.System.DateTime.Now .

Below is an example of an expression:


Below is an example of a script:

var firstName = app.GetDataFieldValue(“ContactSource”, “Contact.FirstName”);

var lastName = app.GetDataFieldValue(“ContactSource”, “Contact.LastName”);

var fullName = firstName + “ “ + lastName;

app.SetScriptReturnValue( fullname );


You can enter any valid JavaScript code in the JavaScript Editor.

As you can see from the examples, expressions and scripts utilize the exposed methods in appRules Portal extensively. Most of these methods require parameters.

You can use the Insert button to configure the parameters of the appRules Portal methods.





Defining Condition Functions


You can define more powerful conditions for your projects by using condition functions instead of condition expressions.  Condition functions allow you to define complete functions with arguments and full access to all workflow activities, variables, arguments and other items in your project.

The functions are defined in Visual Studio.


To define a Condition Function,


1 - create a class library project in Visual Studio


2 - Reference appConnector.System.dll in your project


3 – Define your functions as follow (return must be true or false for a condition function)

You can define as many parameters as you need.




Compile the assembly and copy it into the appRulesPortal/Bin folder.

To use a condition function in a project, it must be associated in its Details properties (functions tab).