Hello, I am Rafael, a technician at Cintech Brazil. We are working on a project with the company Sanepar and we have a problem related to user creation on the portal, specifically in CentralAccount. We are facing an issue with the creation of Keys (Identifier/CentralAccount); this code is presenting a problem whereby upon entering the page to create a new user in the portal and filling in the FirstName and LastName, it generates a sequential number (Identifier) before the user creation is even completed. In other words, when a manager enters the creation form and cancels the creation of the user, it creates a key, causing the sequence to break and leaving this key blank.
Here is the script made in One Identity Designer:
#If Not SCRIPTDEBUGGER Then
Imports System.Collections.Generic
Imports System.Data
#End If
Public Function CCC_External_BuildCentralAccount(ByVal UID_Person As String) As String
Dim f As ISqlFormatter = Connection.SqlFormatter
Dim nextID As ISingleDbObject
Dim intOrderNumber As Integer = 0
Dim prefix As String = "T"
Dim Count As String = String.Empty
Dim Iteration As Integer = 0
'Build CentralAccount
nextID = Connection.CreateSingle("DialogNextID")
nextID("Ident_DialogNextID").NewValue = "External_CentralAccount"
Dim Unique As Boolean = False
While (Unique = False AndAlso Iteration <= 25)
Iteration += 1
intOrderNumber = CInt(nextID.Custom.CallMethod("GetNextID"))
Count = intOrderNumber.ToString().PadLeft(6,"0"c)
Value = prefix & Count
Unique = CCC_Check_Unique_CentralAccount(Value.ToString())
End While
If Iteration > 25 Then
Return "Failed to Generate"
Else
Return Value.ToString()
End If
End Function
We are using version 8.2, and we plan to upgrade to the new version soon.
It could be that the error is not in the script itself, I accept suggestions.