IAdmBusinessRuleConditionedActions2

The IAdmBusinessRuleConditionedActions2 interface extends the IAdmBusinessRuleConditionedActions interface with the possibility to add Else and Else If blocks.

Inheritance: IAdmBusinessRuleConditionedActions

Properties

  • Property

  • Description

  • ElseIfConditionedActions

  • Gets a collection of Else If blocks specified for the action set.

  • ElseActions

  • Gets a collection of actions specified for the Else block of the action set.

Details

ElseIfConditionedActions

Gets a collection of Else If blocks specified for the action set. Each item in the collection is also an action set. Each set is represented by the IAdmBusinessRuleConditionedActions interface.

Examples

The following code sample adds the Else If block to the first action set of a business rule.

PowerShell
# The $rule variable represents a business rule.

# Get the first action set.
$actionsAndConditions = $rule.ConditionedActions.GetObject(0)

# Create an Else If block.
$elseIf = $actionsAndConditions.ElseIfConditionedActions.Create()
$elseIf.ConditionsLogicalOperation = "ADM_LOGICALOPERATION_AND"
$elseIf.SetInfo()

# Create a Delete the object action.
$action = $elseIf.Actions.CreateEx("adm-DeleteObjectAction")
$action.ExecutionOptions = "ADM_ACTIONEXECUTIONOPTIONS_SYNC"
$deleteAction = $action.GetAction()
$deleteAction.DeleteSubtree = $true
$action.SetAction($deleteAction)
$action.SetInfo()

# Add the action to the Else If block.
$elseIf.Actions.Add($action)

# Create an If account is disabled condition.
$condition = $elseIf.Conditions.CreateEx("adm-AccountStatusCondition")
$enabledCondition = $condition.GetCondition()
$enabledCondition.AccountStatus = "ADM_ACCOUNTSTATUS_DISABLED"
$condition.SetCondition($enabledCondition)
$condition.SetInfo()

# Add the condition to the Else If block.
$elseIf.Conditions.Add($condition)

# Add the Else If block to the set.
$actionsAndConditions.ElseIfConditionedActions.Add($elseIf)
C#
// The rule variable represents a business rule.

// Get the first action set. 
IAdmBusinessRuleConditionedActions2 actionsAndConditions = 
    (IAdmBusinessRuleConditionedActions2)rule.ConditionedActions.GetObject(0);

// Create an Else If block.
IAdmBusinessRuleConditionedActions elseIf = 
    (IAdmBusinessRuleConditionedActions)actionsAndConditions.ElseIfConditionedActions.Create();
elseIf.ConditionsLogicalOperation = ADM_LOGICALOPERATION_ENUM.ADM_LOGICALOPERATION_AND;
elseIf.SetInfo();

// Create a Delete the object action.
IAdmBusinessRuleAction action = (IAdmBusinessRuleAction)elseIf.Actions.CreateEx(
    "adm-DeleteObjectAction");
action.ExecutionOptions = ADM_ACTIONEXECUTIONOPTIONS_ENUM.ADM_ACTIONEXECUTIONOPTIONS_SYNC;
IAdmDeleteObjectAction deleteAction = (IAdmDeleteObjectAction)action.GetAction();
deleteAction.DeleteSubtree = true;
action.SetAction(deleteAction);
action.SetInfo();

// Add the action to the Else If block.
elseIf.Actions.Add(action);

// Create If account is disabled condition.
IAdmBusinessRuleCondition condition = (IAdmBusinessRuleCondition)elseIf.Conditions.CreateEx(
    "adm-AccountStatusCondition");
IAdmAccountStatusCondition enabledCondition = (IAdmAccountStatusCondition)condition.GetCondition();
enabledCondition.AccountStatus = ADM_ACCOUNTSTATUS_ENUM.ADM_ACCOUNTSTATUS_DISABLED;
condition.SetCondition(enabledCondition);
condition.SetInfo();

// Add the condition to the Else If block.
elseIf.Conditions.Add(condition);

// Add the Else If block to the set.
actionsAndConditions.ElseIfConditionedActions.Add(elseIf);

ElseActions

Gets a collection of actions specified for the Else block of the action set. Each action in the collection is represented by the IAdmBusinessRuleAction interface.

Examples

The following code sample adds the Else block to the first action set of a business rule.

PowerShell
# The $rule variable represents a business rule.
                    
# Get the first action set.
$actionsAndConditions = $rule.ConditionedActions.GetObject(0)

# Create a Delete the object action.
$action = $actionsAndConditions.ElseActions.CreateEx("adm-DeleteObjectAction")
$action.ExecutionOptions = "ADM_ACTIONEXECUTIONOPTIONS_SYNC"
$deleteAction = $action.GetAction()
$deleteAction.DeleteSubtree = $true
$action.SetAction($deleteAction)
$action.SetInfo()

# Add the action to the Else block.
$actionsAndConditions.ElseActions.Add($action)
C#
// The rule variable represents a business rule 

// Get first action set. 
IAdmBusinessRuleConditionedActions2 actionsAndConditions = 
    (IAdmBusinessRuleConditionedActions2)rule.ConditionedActions.GetObject(0);

//  Create a Delete the object action.
IAdmBusinessRuleAction action = (IAdmBusinessRuleAction)actionsAndConditions.ElseActions.CreateEx(
    "adm-DeleteObjectAction");
action.ExecutionOptions = ADM_ACTIONEXECUTIONOPTIONS_ENUM.ADM_ACTIONEXECUTIONOPTIONS_SYNC;
IAdmDeleteObjectAction deleteAction = (IAdmDeleteObjectAction)action.GetAction();
deleteAction.DeleteSubtree = true;
action.SetAction(deleteAction);
action.SetInfo();

// Add the action to the Else block.
actionsAndConditions.ElseActions.Add(action);

Requirements

Minimum required version: 2018.1

See also