0 votes

We are using a custom form a property patterns to create specific contract resource accounts. We would like to know how to normalize the first and last name fields when the manager is entering them.
(ex. TOM --> Tom or tom --> Tom)

by (3.2k points)

1 Answer

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

Hello,

There is no possibility to achieve what you need using Property Patterns. As a workaround, you can use the PowerShell script below executed by a Business Rule triggering Before Creating a User.

$propertiesToCheck = @("givenName", "sn", "name", "displayName") # TODO: modify me

function FixString ($string)
{
    return $string.SubString(0, 1).ToUpper() + $string.SubString(1).ToLower()
}

foreach ($propertyName in $propertiesToCheck)
{
    # Get value
    $value = $Context.GetModifiedPropertyValue($propertyName)
    if ([System.String]::IsNullOrEmpty($value))
    {
        continue
    }

    # Converting first character of a value to uppercase
    if ($value -match " ")
    {
        $valueParts = $value.Split(" ") | %%{FixString $_}
        $value = [System.String]::Join(" ", $valueParts)
    }
    else
    {
        $value = FixString $value
    }

    # Update property
    $Context.SetModifiedPropertyValue($propertyName, $value)
}
0

Thank you this worked perfectly. Great job and quick turnaround.

0

Sorry to resurrect this but everything seems to be working except the full name field when I set this up.

I have it set to run before user creation. Any ideas?

Screenshot:

0

Hello,

Most probably, this happens because the Full Name property was not included into the $propertiesToCheck array. You need to add cn to the array, which is the LDAP name of the Full Name property.

Related questions

0 votes
1 answer

If the user name submitted is "jhon doe" all of the users properties will be lower case. We want it to force it to be "Jhon Doe" even if it was submitted in lower case.

asked Aug 31, 2022 by raul.ramirez (210 points)
0 votes
1 answer

Good Morning, I'm trying to think of a way to set the username of some of our users who have multiple first and last names. For example, Juan Carlos De Vega. The first ... very first name and last 7 of the very last name? Any help would be appreciated! Thanks

asked Dec 28, 2017 by jhair (520 points)
0 votes
1 answer

Hi, we currenlty have a business rule to send an email everytime the Title, Manager, Department, accountExpires, EmployeeType or FirstName attributes are ... Unit: %BusinessUnit% End Date: %accountExpires% Effective Date of Change: %adm-CustomAttributeDate2%

asked Feb 14 by KevC (60 points)
0 votes
1 answer

We want to get rid off our exchange server and replace it with just Exchange Management Tools (EMT). More details at https://learn.microsoft.com/en-gb/Exchange/ ... account to new "Recipient Management EMT" group to preserve its permissions. Anything else?

asked Mar 30, 2023 by KIT (910 points)
0 votes
1 answer

Hello How can I use a script to search for "123France - Create" in the business rules and replace the "123France - Create" with "France - Update"? This would be an ... done throughout the CN=Business Rules. It will always be searched for "123France - Create".

asked Aug 25, 2023 by DRiVSSi (240 points)
3,326 questions
3,026 answers
7,727 comments
544,678 users