Hello Everyone,
We have a use case, if a manager resigns from organisation, all his direct reportees who are CONTRACTORS should automatically get assigned disabled manager's manager as their personHead. We have catched the person disable event in the process and written a script for the assigning the disabled manager's manager to all active contractors, however this script is working fine if the disabled manager has single reportee, but fails in case of multiple reportees.
Below is the script written for single reportee but I am not getting how do I fetch the result set into an array and iterate it based on the count of reportees that manager has. Can anyone please guide to achieve the same.
Script:
Imports System.IO
Public Function CCC_UpdateManagerHierarchy(ByVal managerUID As String, ByVal managerHead As String) As Boolean
Dim sqlFormatter As ISqlFormatter = Connection.SqlFormatter
Dim reporteeUID As String = Connection.GetSingleProperty("HelperHeadPerson","UID_Person",sqlFormatter.AndRelation(sqlFormatter.Comparison("UID_PersonHead”, managerUID , ValType.String)))
Dim reporteeObject = Session.Source.Get("Person",reporteeUID )
Dim employeetype = reporteeObject.GetValue("CCC_EmployeeType")
Dim status = reporteeObject.GetValue("IsTemporaryDeactivated")
If (employeetype = "1" And status = "False") Then
reporteeObject.PutValue("UID_PersonHead", managerHead)
reporteeObject.Save(Session)
End If
'Return reporteeObject.GetValue("UID_PersonHead")
Return True
End Function