0 votes

I would like to add a CustomAttribute for a Sponsor field for Contractors that is similar to the Manager field where you can do a user lookup from the Web Console to select the user.

From there, I would like to create a Business Rule to update the extensionAttribute9 field with the email address of the Sponsor.

We do not want to use the Manager field for various reasons such as wrong Org Chart information etc.

by (1.1k points)
0

Hello,

Could you describe the whole process in as much details as possible?

0

I would like to have a CustomAttribute field "Sponsor" that is similar to the "Manager" field where you can click the "..." to select the user.

From there, I would like to have a Business Rule to update the account's extensionAttribute9 (friendly name "Sponsor Email") with the Sponsor's email address.

Here is a working sample that works using the "Manager" field, but I would rather not use the Manager field due to some of our other systems using this field, for example an Org Chart.

I am not sure if a CustomAttribute field can be configured this way, but I found that the Secretary and Assistant fields can. I think I can use the Secretary field, but would rather not use the Assistant field as it shows in the GAL.

Also, I am guessing since there is no similar %adm-ManagerEmail% for the Secretary, I am guessing I will need to use a PowerShell Script to do the update?

1 Answer

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

Hello,

It is not possible to use Adaxes custom attributes for Sponsor field to achieve what you need. As you do not want to use Assistant attribute there are only two attributes that meet your requirements: See Also and Secretary. Both attributes are multi-valued. Whichever you select, a PowerShell script should be used to update Sponsor email field. For us to make the script, could you specify the following:

  1. Will there always be only one user in Sponsor field?
  2. If there are several users in Sponsor field, should all their emails be placed into the Sponsor email field separated by a comma?
0

Yes, there will only be one sponsor.

I think the Secretary field should be fine to use.

0

Hello,

Thank you for the confirmation.

You will need to create a Business Rule that will trigger after updating Secretary property of a user. To do so:

  1. Launch Adaxes Administration Console.

  2. Create a New Business Rule.

  3. On step 2 of Create Business Rule wizard select User Object Type.

  4. Select After Updating a User and click Next.

  5. Click Add Action and select Run a program or PowerShell script.

  6. Enter a short description and paste the following script into the Script field:

     $sponsorDNAttribute = "secretary" # TODO: modify me
     $sponsorMailAttribute = "extensionAttribute9" # TODO: modify me
    
     # Get sponsor DN
     try
     {
         $sponsorDN = $Context.TargetObject.GetEx("secretary")
     }
     catch
     {
         return # Sponsor not specified
     }
    
     if ($sponsorDN.Length -gt 1)
     {
         $Context.LogMessage("More than one sponsor is specified", "Warning")
         return
     }
    
     $sponsor = $Context.BindToObjectByDN($sponsorDN[0])
    
     # Get Sponsor Email address
     try
     {
         $mail = $sponsor.Get("mail")
     }
     catch
     {
         $Context.LogMessage("Sponsor email address not specified", "Warning")
         return
     }
     # Update target user
     $Context.TargetObject.Put($sponsorMailAttribute, $mail)
     $Context.TargetObject.SetInfo()
    

  7. Click OK and then double-click the operation succeeded.

  8. Select If <property> changed.

  9. Select If Secretary has changed, click OK and then click Next.

  10. Specify where in Active Directory a user must be updated to trigger this Business Rule. For details check steps 6-8 of the following tutorial: http://www.adaxes.com/tutorials_Automat ... ngUser.htm.

0

Thanks Guys! It works great!

One thing I noticed that doesn't work this way versus the Manager method is that if I clear the Secretary field, it does not clear the extensionAttribute9 field. This is not really much of a problem however as we may update the field, and probably won't be clearing the field often.

0

Hello,

Here is the updated script. It will clear Sponsor email field if Sponsor field is cleared.

$sponsorDNAttribute = "secretary" # TODO: modify me
$sponsorMailAttribute = "extensionAttribute9" # TODO: modify me

function UpdateUser($property, $value)
{
    $Context.TargetObject.Put($property, $value)
    $Context.TargetObject.SetInfo()
}

# Get sponsor DN
try
{
    $sponsorDN = $Context.TargetObject.GetEx("secretary")
}
catch
{
    UpdateUser $sponsorMailAttribute $NULL
    return # Sponsor not specified
}

if ($sponsorDN.Length -gt 1)
{
    $Context.LogMessage("More than one sponsor is specified", "Warning")
    return
}

$sponsor = $Context.BindToObjectByDN($sponsorDN[0])

# Get Sponsor Email address
try
{
    $mail = $sponsor.Get("mail")
}
catch
{
    $Context.LogMessage("Sponsor email address not specified", "Warning")
    return
}

# Update target user
UpdateUser $sponsorMailAttribute $mail
0

Works great!

Thanks! You guys are awesome!

0

Hello,

Thank you for your good words, we really appreciate it!

Related questions

0 votes
1 answer

Using this built in function: There is no option to change the domain on the user account, however this is not the domain we use for UPN. However after creating a user, you can change it but trying to avoid going back into the object.

asked Apr 14, 2023 by mightycabal (1.0k points)
0 votes
1 answer

Create user, read only field In user creation I would like the logon name field and a few others to be read-only, is it possible? In the example of logon name, the technician ... for the field to be "gray" it sees but does not change. https://imgur.com/7DnQGtM

asked Apr 3, 2019 by user1928 (550 points)
0 votes
1 answer

Hello, Is there a way to add a note field on the create user form for additional information. This info would not go into Active Directory but just in the ... etc instead of sending a separate email to IT with additional information. Thanks in advance.

asked Nov 3, 2015 by nturner (100 points)
0 votes
1 answer

Is it possible to add a user to a group based on hardware ? There are users with a Windows device and a MacOS device. I want to be able to choose this when ... the user via Adaxes and automatically link them to a specific group based on the chosen hardware.

asked Apr 16 by Cas (150 points)
0 votes
1 answer

Short question: I have a Powershell script that is generating some information and saving it to a SQL table. Is there some way to save that information into a field in AD ... using Adaxes, but I don't know how to go the opposite way basically. Thanks!

asked Mar 12 by cstaub (50 points)
3,350 questions
3,051 answers
7,791 comments
545,067 users