My business rule "Before adding a member to a group" includes two approval steps.
The first approval should be sent to the member's manager.
The second approval should be sent to the group owner.
The first step is to check if the manager and the group owner are present and active. If this is not the case, the action will be cancelled.
Here it should be specially noted that the CEO does not have a manager, but the second approval step is in this case necessary.
if (member is CEO)
else if (the member has no manager or the manager is disabled) then
show warning "Manager of member has no manager."
If the Group Manager is empty or disabled then
show warning "Group has no owner"
The first approval step can be skipped if the member is the CEO. Can also be skipped if the member's manager and the group owner are the same. This is to avoid that the same person has to approve twice.
if member equal CEO OR
manager of the member equal group owner then
Send operation for approval to manager of group member
In the last step the approval is sent to the group manager.
This action must always be performed.
Send operation for approval (Owner of the target group)