Hi,
Currently having to do a bit of a work around because we update PersonnelNumber on the Person table at a later date than when we setup a users access. So we need to essentially set a flag on CustomProperty10 (just text, e.g. "SAPSENT") when the Personnel number is updated and if they have SAP resources.
Currently my script works via a template so when PersonnelNumber is changed it checks if the user has the right resources and sends an email. The last part, where I need to set the flag, I can't seem to get working. I've listed the full script below. Can anyone provide the VB needed to update the Person record (via the UIDPerson) and set the CustomProperty10?
Public Function ST_Detect_SAP(ByVal Firstname As String, ByVal Lastname As String, ByVal CentralAccount As String, ByVal PersonnelNumber As String, ByVal UIDPerson As String) As String
Dim strMessage As String = String.Empty
Dim strResTmp As String = String.Empty
' Check the employee number length
If (PersonnelNumber.Length > 5 And PersonnelNumber.Length <= 10) Then
Dim f As ISqlFormatter = Connection.SqlFormatter
' Load column
Dim colPersonHasResourceTotal As IColDbObject = Connection.CreateCol("PersonHasRessourceTotal")
colPersonHasResourceTotal.Prototype.WhereClause = f.Comparison("UID_Person", UIDPerson, ValType.String, CompareOperator.Equal, FormatterOptions.None)
colPersonHasResourceTotal.Load()
' Look through resources for SAP resource
If colPersonHasResourceTotal.Count > 0 Then
For Each elem As IColElem In colPersonHasResourceTotal
strResTmp = elem.Create().ObjectWalker.GetValue("FK(UID_ressource).Ident_ressource").String
If strResTmp.StartsWith("SAP_") Then
strMessage &= strResTmp & vbCRLF
' Send email for test
VID_SendMail("Quest.NoReply@domain.co.uk", "vaughan.slater@domain.com", PersonnelNumber, strMessage)
'
' NEED TO UPDATE CUSTOMPROPERTY10
'
Exit For
End If
Next
End If
End If
ST_Detect_SAP = PersonnelNumber
End Function
I essentially either want to use some built in Quest function to SET CustomProperty10 -> "SAPSENT" or via SQL.
Any help is appreciated! I've tried a number of different methods I've been able to find by other people but none have worked..
Cheers,
Vaughan