0 votes

Hello

I need some help to implement the following task:

In a business rule "Before adding a member to a group" an approval should be sent to the manager of the member who will be added to the group.

Do you have an example for this?

Thanks and greetings Pudong

by (680 points)
0

Hello Pudong,

It can only be done using a script. For us to provide you with the script, please, specify what should be done in case if the member being added does not have a manager. Any additional details will be much appreciated.

0

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) do nothing else if  (the member has no manager or the manager is disabled) then show warning "Manager of member has no manager." Cancel Operation

If the Group Manager is empty or disabled then show warning "Group has no owner" Cancel Operation

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 do nothing Else 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)

regards pudong

0

Hello Pudong,

Could you, please, post here or send us (support@adaxes.com) a screenshot of the business rule? Also, please, specify how exactly you determine whether a user is CEO& is it about some property value?

1 Answer

0 votes
by (294k points)
selected by
Best answer

Hello Pudong,

Thank you for the provided details. Here are the scripts for your business rule.

Check if member manager is disabled

$Context.ConditionIsMet = $False

# Bind to the member
$member = $Context.BindToObject("Adaxes://%member%")

# Get member manager
try
{
    $managerDN = $member.Get("manager")
    $manager = $Context.BindToObjectByDN($managerDN)
}
catch
{
    return
}

$Context.ConditionIsMet = $manager.AccountDisabled

Submit for approval to the member manager

# Bind to the member
$member = $Context.BindToObject("Adaxes://%member%")

# Get member manager
try
{
    $managerDN = $member.Get("manager")    
}
catch
{
    $Context.LogMessage("%adm-MemberFullName% has no manager", "Information")
    return
}

# Submit for approval
$Context.SubmitForApproval(@($managerDN), $False, $False, $False, $False)
0

Hello Sorry for the late feedback, I needed some time to test the scripts. Everything works as desired :D Thanks a lot!

Related questions

0 votes
1 answer

Hello Adaxes Team You have already helped me to send an approval to the manager of a user. https://www.adaxes.com/questions/12406/send-approval-request-to-manager- ... to a group, DivManager1 should receive the approval request. thank you and greetings pudong

asked Jul 11, 2022 by pudong (680 points)
0 votes
0 answers

As the title mentions, I'm trying to figure out a way to have HR apply multiple modifications on a user's account (change of position, title, department, phone, etc...) ... phone number (in the same form), it sends two approval requests. Thanks for your help!

asked Jan 26, 2022 by lw.fa (150 points)
0 votes
1 answer

Hello, Is there a way to send an email notification when a user is added to a group dynamically (with LDAP filter) , it's work only when i add the user manually Thank you

asked Jun 30, 2021 by GG (70 points)
0 votes
1 answer

I need a specific user, when requesting another user to join a group, to have an approval sent to the AD management team. I tried to create a "Business Rule", but I'm getting an "Access Denied" error. Any idea what this could be?

asked Aug 20 by fgmello (40 points)
0 votes
1 answer

Is there any way to add a warning message when someone tries to add a group member that already is member? Checked config but found nothing related. Added a new member that ... the group and there is no warning, and the logs show that the task was completed.

asked Jul 9 by lramirez (20 points)
3,588 questions
3,277 answers
8,303 comments
548,086 users