0 votes
$property = "mail" # TODO: modify me
#$regex = "^[a-zA-Z0-9_.%%\-\+]+@([a-zA-Z0-9_\-]+\.)+[a-zA-Z0-9_\-]+$" # TODO: modify me

# Get property value
$value = $Context.GetModifiedPropertyValue($property)

if ([System.String]::IsNullOrEmpty($value))
{
    return # The property wasn't changed
}

# Remove spaces
$value = $value.Replace(" ", ".")

# Remove dashes
$value = $value.Replace("-", ".")

# Remove underscores
$value = $value.Replace("_", ".")


# Validate property
#if ($value -notmatch $regex)
#{
#    $Context.Cancel("The property must match the following regular expression: $regex") # TODO: modify me
#}

# Update property value
$Context.SetModifiedPropertyValue($property, $value)
by (1.3k points)

1 Answer

0 votes
by (174k points)

Hello Derek,

As per our check, the script works just fine. Make sure it is executed in a Business Rule triggering Before an operation (e.g. Before creating a user, Before updating a user). Should you still have issues with the script replacing spaces and/or characters, please, provide us with all the possible details regarding the issues. If you face error messages, please, post here or send us (support[at]adaxes.com) screenshots.

0

Yes i am runnign th correct script.

image.png

image.png

Still dashes and underscores:

image.png

0

Hello Derek,

According to the execution log, you are mail-enabling the group first and only then the script that replaces spaces and special characters is executed. You need to separate the actions into two Business Rules. Finally, you should have something like the following:

  • Business Rule triggering Before creating a group image.png
  • Business Rule triggering After creating a group image.png
0

Same result.

setup:

image.png image.png

test: image.png

Result: image.png

0

Hello Derek,

The behavior occurs because the first action in your Business Rule triggering After creating a group ( i.e. set Email to %cn%@ahfproducts.com) overrides the results of the script execution. Also, you are using a different property as alias then the one updated by the script which overrides the email property one more time after the email address is being established. You need to make sure that the script updates the very same property that is used in the establish email address action as alias and remove the first action from the Business Rule triggering After creating a group.

0

Thank you. I can't believe i missed that.

Works !

Related questions

0 votes
1 answer

After creating a new user I'm modifying the user and setting 2 proxy addresses. I'm doing this with the build-in modify user functionality. Our email format is %firstname%. ... anybody have an idea to get this working, i'm not as Powershell wizzard...

asked Oct 15, 2018 by Quinten (480 points)
0 votes
1 answer

I have an ADP Sync scheduled task that modifies and creates users from a csv file. I also have reports that show new users created and management history for user ... ADP Sync scheduled task so that they only run after the ADP Sync task is complete?

asked Jan 7 by barberk (290 points)
0 votes
0 answers

Hi, I found the following example to remove special characters from an attribute but somehow I can't get it to work. I'm using this script in a business rule before ... "Information") } } Can someone identify what i'm doing wrong? Incorrect if statement?

asked Mar 4, 2019 by Quinten (480 points)
0 votes
0 answers

By default, Web Interface URLs look like the following: http://host.company.com/Adaxes/HelpDesk. For the URLs not to contain the Adaxes part: On the computer where Adaxes ... C:\Program Files\Softerra\Adaxes 3\Web Interface by default. Click OK. Restart IIS.

asked Oct 30, 2019 by Support2 (174k points)
0 votes
0 answers

We are looking for a tool that can support a blacklist for password resets and that will enforce this blacklist to certain OU groups but not others, or potentially use a whitelist of users that it will not be enforced upon.

asked Mar 2 by zachThankYou (250 points)
2,135 questions
1,900 answers
5,319 comments
3,535 users