We are using a script to set the phone number in a business rule after creating a user :

$user = Get-AdmUser -Identity %sAMAccountName%
Set-AdmUser -Identity $user -OfficePhone $formattedNumber

In an other script in the same business rule (but with different conditions) i want to get the setted phone number, but i can't get this to work. I tried differt things:

$Context.GetModifiedPropertyValue("telephoneNumber")
%telephoneNumber%

But both won't work, is there another option?

by (50 points)

1 Answer

by (305k points)
Best answer
0 votes

Hello Marcel,

To achieve the desired, you need to make sure that both operations are performed on the domain controller Adaxes is connected to. The referenced lines from the first script should be replaced with below:

$Context.TargetObject.Put("telephoneNumber", $formattedNumber)
$Context.TargetObject.SetInfo()

As for the second script, use the approach like below to obtain the property value:

try
{
    $telephoneNumber = $Context.TargetObject.Get("telephoneNumber")
}
catch
{
    $telephoneNumber = $NULL
}
by (50 points)
0

Thanks! Works :-D

Related questions

Hi! What am I missing, we are running 2018.2, we've edited a webform using web interface configurator. I've added the telephone field in section general under Management heading ( ... it to both modify tab and create tab. Any hints what I'm doing wrong? /Kaj

asked Jul 10, 2019 by KajLehtinen (650 points)
0 votes
1 answer

Hi! I'm new to Adaxes and this is my first post. I need som assistance on writing an entered phone number on one hand for the human eye in the telephone attribute ... keep the format including spaces, for the AD User object pleasing for the eye? Thanks, Micael

asked Jan 11, 2019 by ecit (100 points)
0 votes
1 answer

Using this code: $UserAD = $Context.BindToObjectByDN($DNAD) $UserAD.Put("thumbnailPhoto", $photoBytes) $UserAD.SetInfo() I doesn't create a log in adaxes of the photo being updated. ... s something simple but I can't remember or find it in my support emails.

asked Aug 13 by mightycabal (1.1k points)
0 votes
1 answer

For any given AD attribute, I'd like to be able to retrieve the defined friendly name for it. Example: l = City, st = State, etc. Is there a way to do that in PowerShell? Thanks!

asked Aug 8 by jaymallery (20 points)
0 votes
1 answer

Recently we started getting this error in Adaxes Some fields couldn't be loaded. Failed to get the mailbox usage information. Failed to commit the change on object " ... are correct but the issue persists. This is occuring with Exchange Online only:

asked May 21 by curtisa (350 points)
0 votes
1 answer