- Are All Rules TRUE By Rule Set Name
- Get Parent Rule
- Get Rule Condition
- Get Rule Name
- Get Rule Set Name
- Get Rule Sets With Category
- Get Current Rule Version
- Execute Rule Set By Rule Set Name
- Execute Rule Set By Rule Set Name With Parameters
- Execute Independent Rule Set By Rule Set Name
- Execute Independent Rule Set By Rule Set Name With Parameters
- Execute Fire Notification Rule Set
- Activate Rule Set by Rule Set Name
Are All Rules TRUE By Rule Set Name
Returns TRUE if all rules within the provided rule set have evaluated to TRUE.
Parameters
- ruleSetName (Text)
Return Type
Boolean
Script
var ruleSet = Context.Entity.RuleSets[ruleSetName]; for (var rule in ruleSet.RuleElements){ if (rule.Value.ToBoolean() == false){ return false; } } return true;
Get Parent Rule
Returns the rule name of the parent rule.
Parameters
None
Return Type
Text
Script
var def = Context.RuleElement.GetDef(); def = def.Parent; return def.Name;
Get Rule Condition
Returns the rule condition expression of the provided rule.
Parameters
- ruleSetName (Text)
- ruleName (Text)
Return Type
Text
Script
var ruleset = Context.Entity.RuleSets[ruleSetName]; var rule = ruleset.RuleElements[ruleName];
return rule.GetDef().ConditionExpression
Get Rule Name
Returns the rule name for the currently executing rule.
Parameters
None
Return Type
Text
Script
if (Context.RuleElement == null) return "null"; else return Context.RuleElement.Name;
Get Rule Set Name
Returns the rule set name for the currently executing rule set.
Parameters
None
Return Type
Text
Script
return Context.RuleSet.Name;
Get Rule Sets With Category
Returns the rule set names in a comma separated list for the rule sets tagged with the supplied categoryName.
Parameters
- categoryName (Text)
Return Type
Text
Script
var rulesWithCat = "";
for (var ruleset in Context.Entity.RuleSets) { for (var category in ruleset.GetDef().AssignedCategories) { if (category == categoryName) { if(rulesWithCat != "") { rulesWithCat += ","; }
rulesWithCat += ruleset.Name; } } } return rulesWithCat;
Get Current Rule Version
Returns the current active version of the supplied rule in the supplied rule set.
Parameters
- ruleSetName (Text)
- ruleName (Text)
Return Type
Text
Script
for (var rule in Context.Entity.RuleSets[ruleSetName].RuleElements) { if (rule.Name == ruleName) { return rule.Name + "/" + rule.ActiveVersionName; } } return "";
Execute Rule Set By Rule Set Name
Executes the supplied Explicit entity rule set.
Parameters
- ruleSetName (Text)
Return Type
None
Script
Context.Entity.ExecuteRuleSet(ruleSetName);
Execute Rule Set By Rule Set Name With Parameters
Executes the supplied Explicit entity rule set with parameters.
Parameters
- ruleSetName (Text)
- param1Value (Text)
- param2Value (Text)
Return Type
None
Script
Context.Entity.ExecuteRuleSet(ruleSetName,param1Value,param2Value)
Execute Independent Rule Set By Rule Set Name
Executes the supplied independent rule set.
Parameters
- ruleSetName (Text)
Return Type
None
Script
Context.CreateIndependentRuleSet(ruleSetName).Execute();
Execute Independent Rule Set By Rule Set Name With Parameters
Executes the supplied independent rule set with parameters.
Parameters
- ruleSetName (Text)
- param1Value (Text)
- param2Value (Text)
Return Type
None
Script
Context.CreateIndependentRuleSet(ruleSetName).Execute(param1Value,param2Value)
Execute Fire Notification Rule Set
Executes a rule set containing only a Fire Notification. This function allows notifications to be in-lined within UDFs. The rule set parameter includes the message text.
Parameters
- messageText (Text)
Return Type
None
Script
var mytestvar = 2; Context.Entity.ExecuteRuleSet("FireNotificationRuleSet","I just set my variable to 2");
mytestvar = 4;
Context.Entity.ExecuteRuleSet("FireNotificationRuleSet","Now I set my variable to 4"); Context.Entity.ExecuteRuleSet("FireNotificationRuleSet","The next message will take the text passed in from a rule"); Context.Entity.ExecuteRuleSet("FireNotificationRuleSet",messageText);
Activate Rule Set by Rule Set Name
Activates the supplied rule set.
- Parameters ruleSetName (Text)
Return Type
None
Script
Context.Entity.ActivateRuleSet(ruleSetName);
Comments
0 comments
Please sign in to leave a comment.