Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
surname-hr-import.vb
Case "sn-HRMA-Import"
'HR attributes required are:Surname, AccountName
'Ensure that this attribute has spaced Hypens corrected
Dim surnamelogFileName As String = dtDateNowDay & "-" & dtDateNowMonth & "-" & dtDateNowYear & "_HRMA_Surname.log"
Logging.SetupLogFile(surnamelogFileName, loggingLevel)
If csentry("Surname").IsPresent Then
If csentry("Surname").Value.ToLower = "null" Then
mventry("sn").Delete()
If csentry("AccountName").IsPresent Then
Throw New Exception("Error in Surname (null) for FedID: " & csentry("AccountName").Value)
Else
Throw New Exception("Error in Surname (null) for PID: " & csentry("PID").Value) 'PID is the anchor - if this is missing we have more serious problems
End If
Else
Dim tString As String = Regex.Replace(csentry("Surname").Value, "[^a-zA-ZÀÈÌÒÙàèìòùÁÉÍÓÚÝáéíóúýÂÊÎÔÛâêîôûÃÑÕãñõÄËÏÖÜŸäëïöüÿ_\-\'\ ]", "")
'tString = tString.Replace(" - ", "-")
If tString <> csentry("Surname").Value Then
If csentry("AccountName").IsPresent Then
Throw New Exception("Error in Last Name format for FedID: " & csentry("AccountName").Value & ", Firstname: " & csentry("Surname").Value)
Else
Throw New Exception("Error in Last Name format for PID: " & csentry("PID").Value & ", Firstname: " & csentry("Surname").Value) 'PID is the anchor - if this is missing we have more serious problems
End If
Else
mventry("sn").Value = Replace(csentry("Surname").Value.Trim, " - ", "-")
End If
End If
Else
If csentry("AccountName").IsPresent Then
Logging.Log("Surname not Present for: " & csentry("AccountName").Value, True, 0)
Else
Logging.Log("Surname not Present for: " & csentry("PID").Value, True, 0) 'PID is the anchor - if this is missing we have more serious problems
End If
End If
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.