0 votes

We have run into an issue where the special characters in a person's name are causing havoc with email addresses. We need to remove all special characters and only leave letters when creating the email address. Right now we are creating email with the Firstname Lastname parameters. We assume we want to use the FullName and remove the characters before creation. Please advise.

by (3.2k points)

1 Answer

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

Hello,

Have a look at the following tutorial: http://www.adaxes.com/tutorials_Simplif ... Script.htm. On step 5 check Example 6: Replace characters in the username.

0

We would like this script only to modify the alias on the email address. The special characters are breaking import to other databses that pull email addresses. Full Names are ok with special characters.

Please advise.

0

Hello,

Then, you need to add the mailNickname attribute to the $props variable. The 1st line of the script will look as follows:

$props = @("mailNickname")
0

Hello Support,

We just determined this either did not work or stopped working.

$props = @("mailNickname", "mail")
$map =@{ "å"="a"; "ö"="o"; "ä"="a";"ü"="u"; "ñ"="n"; "é"="e"; "-"=""; "'"="" }

foreach ($prop in $props)
{
    if ($Context.IsPropertyModified($prop))
    {
        $value = $Context.GetModifiedPropertyValue($prop)

        foreach ($key in $map.Keys)
        {
            $value = $value.Replace($key, $map[$key])
        }

        $Context.SetModifiedPropertyValue($prop, $value)
        $Context.LogMessage($prop + ": " + $value, "Information")
    }
}

Please advise on how to get a successful script to remove these special characters.

0

Hello,

What makes you think that the script is not working? Do you face any error messages? If you do, could you post here or send us screenshots?

How exactly do you execute the script? Is it executed as part of a Business Rule? If yes, could you post here or send us a screenshot of the rule configuration? We need something like the following:

0

We started with a custom command that runs within a Business Rule. During troubleshooting we have disabled the business rule and run it directly from custom command, the test account we are using has the following information that is not changing after a reported successful script run.

0

Hello,

The script must be executed by a Business Rule that triggers Before Updating or Creating a User. Also, it must be executed by the Run a program or PowerShell script action. If a Custom Command with the script is added to the Business Rule, the script will not work. Here is an example of the rule configuration for the script to work:

Also, make sure that your test user is within the Activity Scope of the Business Rule.

0

Ok we have it set up as a Business Rule that runs just like your example.


Here are the results, it looks like it is successful however no changes were made to email address or alias

0

0

Hello,

Check our post one more time. The Business Rule must trigger Before Updating or Creating a User, not After.

0

ok, i was thinking i needed to have the email alias created first before it could remove characters. I deleted the previous business rule and created it for before creating a user.

0

Hello,

As we can see there is a Business Rule that creates a mailbox for the user after the script is executed. You need to create another Business Rule that will trigger Before Creating an Exchange mailbox for a User and execute the script below.

$map = @{ "å"="a"; "ö"="o"; "ä"="a";"ü"="u"; "ñ"="n"; "é"="e"; "-"=""; "'"="" }
$alias = $Context.Action.MailAlias
foreach ($key in $map.Keys)
{
    $alias = $alias.Replace($key, $map[$key])
}
$Context.Action.MailAlias = $alias

The rule should look as follows:

0

Thank you the missing piece was the Before Creating an Exchange Mailbox. Worked flawlessly.

Related questions

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 (100 points)
0 votes
1 answer

I want to remove special characters on the onboarding web form for username and mail before clicking Finish. Using a script like on the rule "Before User Creation" seems to to do the change to late and you can not verify the email adress before created.

asked Dec 27, 2021 by joem (20 points)
0 votes
1 answer

Hi all, I've created a 'View User' command via the Web Interface Configurator. I don't want users to be able to make any changes, so I've created a Custom ... there any way to remove this, short of removing the entire Exchange section itself? Thanks, David

asked Sep 5 by dshortall (80 points)
0 votes
1 answer

Hello, A new question : when I create a new contact in Adaxes, I'd like the email address automatically created. How can I do this ? Thanks for your response. Yoann

asked Oct 15, 2012 by yoann.hamon (180 points)
0 votes
1 answer

I am trying to create a business rule to send an email to the manager of the group when a member is added or removed from a rule-based group. I have created the business rule and it works for other groups but not for a rule-based group. Can this be done?

asked Jul 19, 2021 by mark.it.admin (2.3k points)
3,548 questions
3,238 answers
8,232 comments
547,811 users