0 votes

I'm sure I've seen this asked before but I can't seem to find it now.

I want a user to enter a 8 digit number and I want to be able to record the 8 digit number in AD and then manipulate the last 6 digits with a new prefixes too. For example, if a user enters 99123456 I also need 88123456 and 77123456 recorded in AD fields.

Is there a way to do this?

Jim

by (140 points)

1 Answer

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

Hello Jim,

Yes, there is. You can do this with the help of a PowerShell script. For example, here's a script that changes a telephone number prefix and saves all the resulting telephone numbers to a multivalued property called Telephone Number (Other). The prefixes that will be added by the script are specified by $prefixes.

$prefixes = @("99", "88", "77") # TODO: modify me

# Get telephone number
$telephoneNumber = "%telephoneNumber%"
$telephoneNumberPart = $telephoneNumber.Trim().SubString($telephoneNumber.Length - 6)

$numbers = @()
foreach ($prefix in $prefixes)
{
    $number = "$prefix$telephoneNumberPart"
    if ($number -eq $telephoneNumber)
    {
        continue
    }

    $numbers += $number
}

# Commit to the Active directory
$Context.TargetObject.PutEx("ADS_PROPERTY_APPEND", "otherTelephone", $numbers)
$Context.TargetObject.SetInfoEx(@("otherTelephone"))

To assign the phone numbers automatically upon creating a new user, for example, you'll need to run the PowerShell script as a part of a Business Rule triggered after creation of a new user. For information on how to create such a Business Rule, see the following tutorial: http://www.adaxes.com/tutorials_Automat ... ngUser.htm. If you need help with adjusting the script to your needs, we will help you.

0

Thanks, that's close but I'd need each prefix plus the telephone number (last 6 of the phone) each in their own AD field.

0

Hello,

This is also very easy to achieve. Here's another version of the script that saves telephone numbers with different prefixes to different attributes. In this version of the script, $prefixInfos specifies a map of the prefixes to their respective attributes.

$prefixInfos = @{
    "99" = "adm-CustomAttributeText1";
    "88" = "adm-CustomAttributeText2";
    "77" = "adm-CustomAttributeText3"
} # TODO: modify me

# Get telephone number
$telephoneNumber = "%telephoneNumber%"
$telephoneNumberPart = $telephoneNumber.Trim().SubString($telephoneNumber.Length - 6)

foreach ($prefix in $prefixInfos.Keys)
{
    $number = "$prefix$telephoneNumberPart"
    if ($number -eq $telephoneNumber)
    {
        continue
    }

    $Context.TargetObject.Put($prefixInfos[$prefix], $number)
}

# Commit changes to Active directory
$Context.TargetObject.SetInfo()

Related questions

0 votes
1 answer

Hello, till now we are using "Connect-ExchangeOnline -Credential $svcmsolsync -Prefix O365 #Session aufbauen" in your taks. After updating to adaxes 2023.2 there is a ... question, is there a way to turn off this restriction? Kind regards Jo Schmitz

asked Aug 10, 2023 by jo.schmitz (20 points)
0 votes
1 answer

Hello, our users have to login to the Adaxes web service by using their username and password, no SSO is used. I have configured the option in the web interface ... /access control, but after some weeks/months this happens again. Thank you Regards, Thorsten

asked Jun 4, 2014 by techman26 (240 points)
0 votes
1 answer

Hi I need a special company subsidaries parameter, where i would like to have the name of all the subsidary company as drop down and use this parameter in the create user page. ... but how can i insert a drop down menu in it? Thanks for your support Kamini

asked Feb 11, 2022 by Kamini (80 points)
0 votes
1 answer

The section is not defined in the available options in Adaxes and it is in the AD as well. Eg; I need to add a section called ' Security Access' and have it ... to select from options like User Directory, Internet access, Track-It account , SAP access etc.

asked Oct 13, 2021 by Aishwarya Gavali (40 points)
0 votes
1 answer

Is it possible to create a drop down that displays options based on the selection in another field? EX: I want to create a job title background that will populate options ... like the Job title drop down to display "Customer service rep, call support, etc".

asked Oct 11, 2021 by copatterson (70 points)
3,548 questions
3,239 answers
8,232 comments
547,814 users