Script to update attribut in Web Form

Hello All ;)

I'm trying to make a script to automatically update an fiel in a form of Web Interface.

I need to update the GivenName attribut.

Givenname must be transformed to respect First Character in uppercase, and next other character in lowercase.

I have a script Powershell who work fine:

function Generate-GivenName()
# Variable
$GivenName = $Request.Get("GivenName")

$NewGivenName = $GivenName.substring(0,1).toupper()+$GivenName.substring(1).tolower()

return $NewGivenName

But I don't know to automatically update attribut field in form when user has filled it.

Thanks for your help


  • Hi GéGé

    I'm assuming this is to prevent someone entering a username that doesn't conform to your companies business rules?

    There are a couple of way to do something like this, depending on who should be responsibile for correcting the given name into the correct format.

    1. Administration Policy - Person creating/updating the user is responsible to enter the correct information

    Using an Administration Policy, you could specify a rule which says that the username must be 1 Char upper case, and the remainder lower case, or better still use a Regular Express rule to do the same. But also you may need to take into account that some countries may have expection cases to first character upper case, and the remainder lower case.

    This method would not automatically change the case of the given name, but if the user entering the information clicked next, an error would be displayed on the form (and the message you can customise), which would then put the onus on that user to correct. Its the simplest, but the effort is required at the user end.

    2. Change Workflow & Script - System updated after the end user submits there request (creation of user and/or update of the users  given name)

    Using an workflow, you can intercept the request (to create or modify the user), where by you can use a "Modify Requested Changes" workflow activity to amend the value the end user has submitted.

    Using this method you would

    • Create a change workflow
    • Modify the starting condition to be:
      • Operation that starts this workflow: Modify properties
      • Target object type: User
      • Workflow start upon a request for changes to:
        • First Name (givenName)
      • Initiator conditions
        • Initiator: <Any User?>
        • Container: <OU of the users you want to be changed or Active Directory>
      • Filtering Conditions:
        • Any filter you want to add
    • Add a "Modify Requested Changes" activity to the "Pre-Modify" section of the workflow
    • Modify the Modify Request Changes activity:
      • Set the Name and Description of the activity as appropriate for you
      • On the Target Change tab:
        • Click on the drop down next to "Add Properties"
        • Select "More Choices"
        • Select "First Name (givenName)" from the list and click Ok
        • Leave the action as "Set"
        • Click on the drop down next to "Define"
        • Select "Value generated by rule expression..."
        • Click "Add Entry"
        • Click "Value generated by script"
        • On the "configure entry" form:
          • Select your script
          • Select the function in your script to run
          • NB: Your script must be present in a script module within Active Roles
          • Click Ok
        • Then Click Ok
      • Then again click Ok
    • Then test by modifying a test account in scope of your workflow

    This method will not change the value in the existing form, but will modify the value before the change is submitted to AD

    There is a third option, which is more inline with what you're trying to do, but I'll need some more time to document that.