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 (288k 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

On the Create User form, I'm trying to set some predefined fields to prepopulate the Last Name and Username fields. If I set just the Username field, it works fine ... changed to 'svc_@domain1' How do I predefine both fields, but keep the domain as @domain2?

asked Nov 8 by jmatthews (170 points)
0 votes
1 answer

I am unsure how to deal with this because of how Adaxes treats one identity account as two different objects, an AD and AzureAD user account, and both has different last logon values. What is a good way to combine the data?

asked Apr 22 by Daniel (140 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)
3,541 questions
3,232 answers
8,225 comments
547,802 users