AdhocProjection - ObjectExists throws Error

Hi,

I'm trying to check the provisioning status of an ADSAccount object in a custom process on TroubleTicket. In the ObjectExists process step, I'm passing the entity patch using the UID_ADSAccount value received in the previous steps via outparam. I'm getting the following error:

Error generating process CCC_TroubleTicket_Test.
at DynScripts.JobGen_TroubleTicket_G7rpoa20EAIF5FxdHhdoHlgJdJSdfs4.Event_E_NEW_4000(JobGenContext context)
at DynScripts.JobGen_TroubleTicket_G7rpoa20EAIF5FxdHhdoHlgJdJSdfs4.Chain_CCC_TroubleTicket_Test(JobGenContext context, String EventName)
Error generating process step Check Account exists in TargetSystem.
at DynScripts.JobGen_TroubleTicket_G7rpoa20EAIF5FxdHhdoHlgJdJSdfs4.Chain_CCC_TroubleTicket_Test(JobGenContext context, String EventName)
at DynScripts.JobGen_TroubleTicket_G7rpoa20EAIF5FxdHhdoHlgJdJSdfs4.Job_CCC_TroubleTicket_Test_ProcessMustWait(JobGenContext context, String EventName, JobChain myChain, IVarContext chainValues)
Error running prescript.
at DynScripts.JobGen_TroubleTicket_G7rpoa20EAIF5FxdHhdoHlgJdJSdfs4.Job_CCC_TroubleTicket_Test_Check_Account_exists_in_TargetSystem(JobGenContext context, String EventName, JobChain myChain, IVarContext chainValues)
Object of type Active Directory user accounts does not exist in database or you do not have the relevant viewing permissions.

Below is my Pre-Script code in the ObjectExists step.

If EventName.Equals("E_NEW_4000",StringComparison.OrdinalIgnoreCase) Then

Imports System.Collections.Generic
Dim ADData As IDictionary(Of String,String) = Nothing
values("AD_AdHocDataFound") = False

Dim adsDataFound As Boolean = True

Dim accEntity As IEntity = Session.Source.Get(DAI_Table.ADS_ACCOUNT,"&out(UID_ADSAccount)&",EntityLoadType.Default)
values("AD_Patch") = DPR_WrapObjectForProjection(accEntity)

' try to get AD data
Try
ADData = DPR_GetAdHocData(accEntity.CreateWalker(Session).GetValue("FK(UID_ADSDomain).XObjectKey").String,"ADS","","Update",accEntity)
Catch ex As Exception
adsDataFound = False
End Try

If Not ADData Is Nothing
values("AD_AdHocDataFound") = True
values("AD_UID_DPRSystemVariableSet") = ADData("VariableSetUID")
values("AD_UID_DPRProjectionConfiguration") = ADData("ProjectionConfigUID")
values("AD_UID_QBMServer") = ADS_GetQBMServer(ADData("ExecutionServerUID"), accEntity, ADData("ExecutionServerTag"))
End If

End If

Any idea, on what's causing this error in Pre-Script code?