This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Change initial value of CentralPassword during the creation of a Person

Hello,

In the project that I'm doing for a Customer the have a pattern to define the initial value of the password based on the FirstName, LastName and the date of the creation.

I'm modifying the CentralPassword Template to generate it but after the creation of the Person, the password is not configured correctly. Is not empty so probably is using a random password.

How could I modify that column so the first value is based in my code instead of in a random password?

The purpose if this is generate two different AD account in different domains but with the same password and, whenever a helpdesk person changes the centralpassword, replicates it to the domains.

Thx!

Parents Reply Children
  • Hello,

    Markus, as you said, the OnSaving is the key.

    Thank you very much, Markus and Barry!

    This is the code that I have added there:

    If NOT $[IsLoaded]:Bool$ Then

        'Chequeamos que haya First Name y Last Name
        If not String.IsNullOrEmpty($Firstname$) AndAlso not String.IsNullOrEmpty($Lastname$) Then
            Dim today As Date = DateTime.now
            Dim Password As String = ""
            Password += $FirstName$.Substring(0,1)
            Password += "*"
            If today.Day.ToString().Length = 1 Then
                Password += "0" + today.Day.ToString()
            else
                Password += today.Day.ToString()
            End If
            If today.Month.ToString().Length = 1 Then
                Password += "0" + today.Month.ToString()
            else
                Password += today.Month.ToString()
            End If
            Password += "*"
            dim PrimerApellido as String
            dim SegundoApellido as String
            If InStr($LastName$, " ") > 0 Then
                    PrimerApellido = $LastName$.Split(New Char() {" "c})(0)
                    SegundoApellido = $LastName$.Split(New Char() {" "c})(1)
                Else
                    PrimerApellido = $LastName$
                    SegundoApellido = $LastName$
                End If
            If PrimerApellido.Length > 2 then
                Password += PrimerApellido.Substring(PrimerApellido.Length - 2)
            else
                Password += PrimerApellido
            end if
            Password = Password.ToLower
            
            Entity.PutValue("CentralPassword",Password)
        end if

    End If