ftos.businessStatusWorkflow.testCondition
IMPORTANT!
Starting with v24.3.0, this is renamed from checkBusinessConditionForData to ftos.businessStatusWorkflow.testCondition.
Starting with v24.3.0, this is renamed from checkBusinessConditionForData to ftos.businessStatusWorkflow.testCondition.
Evaluates a business workflow condition for an explicitly given data set.
This is a business logic method for business service components.
Syntax
function ftos.businessStatusWorkflow.testCondition(entityName: string, dataSet: any[], businessWorkflowConfigurationName: string, conditionName: string): boolean
| Parameter | Description |
|---|---|
entityName
|
Name of the entity that contains the business workflow configuration that contains the evaluation's business condition. |
dataSet
|
Array of key – value pairs to be evaluated by the business condition. IMPORTANT! The key names must match the attributes evaluated by the business condition. |
businessWorkflowConfigurationName
|
Name of the business workflow configuration that contains the evaluation's business condition. |
conditionName
|
Name of the evaluation's business condition. |
The dataSet array has the following structure:
[
{
key: '<attribute 1>',
value: <value 1>
},
{
key: '<attribute 2>',
value: <value 2>
}
...
]
Return Value
Returns true if the condition is met and false if it isn't.
Examples
In this example:
- We check if a potential customer (who is not yet registered in our database) is eligible for a product. The candidate has a credit score of 7.5 and was born on January 20th 1971 (1971, 1, 20).
- We store the candidate's credit score and birthday in the candidateCreditScore and candidateBirthday variables respectively.
- We evaluate the candidate's data against the eligibility business condition stored in the customersWF for customers business workflow of the customers entity.
- The eligibility business condition is set up to run evaluations on the creditScore and birthday attributes of the customers entity.
- We store the result in a variable called validation.
var candidateCreditScore = 7.5;
var candidateBirthday = '1971, 1, 20'
var validation = ftos.businessStatusWorkflow.testCondition('customers', [{key: 'creditScore', value: candidateCreditScore},{key: 'birthday', value: candidateBirthday}], 'customersWF for customers', 'eligibility');