Sample runbase class without parameters
class BPAADimportTriggerService extends RunBaseBatch
{
public server static BPAADimportTriggerService construct()
{
return new BPAADimportTriggerService();
}
/// <summary>
/// </summary>
/// <returns>Return the class desc</returns>
public client server static ClassDescription description()
{
return "Azure AD user import process";
}
/// <summary>
/// </summary>
/// <returns>Whether the class can be used in a batch task</returns>
protected boolean canGoBatchJournal()
{
return true;
}
/// Allows the class go batch
/// </summary>
/// <returns>Return the result</returns>
public boolean canGoBatch()
{
return true;
}
/// <summary>
/// </summary>
/// <returns>Return the true result</returns>
public boolean runsImpersonated()
{
return true;
}
public static void main(Args _args)
{
BPAADimportTriggerService triggerService = BPAADimportTriggerService::construct();
if (triggerService.prompt())
{
triggerService.run();
}
}
public void run()
{
BPAADHCMWorkerLog workerLog;
HcmWorker worker;
BPAADEmpImportInegraitonParameters intParam = BPAADEmpImportInegraitonParameters::find();
if(intParam.EnableFunctionality)
{
ttsbegin;
update_recordset workerLog
Setting BPAADExecutionSummaryStatus = BPAADExecutionSummaryStatus::Executing
where workerLog.BPAADExecutionSummaryStatus == BPAADExecutionSummaryStatus::NotRun
&& workerLog.CustomUserId
&& workerLog.BPMPAADInsertUpdateDelete == BPMPAADInsertUpdateDelete::Insert
exists join worker
where worker.RecId == workerLog.worker ;
ttscommit;
while select workerLog
where workerLog.BPAADExecutionSummaryStatus == BPAADExecutionSummaryStatus::Executing
&& workerLog.CustomUserId
&& workerLog.BPMPAADInsertUpdateDelete == BPMPAADInsertUpdateDelete::Insert
join worker
where worker.RecId == workerLog.worker
{
BPAADImportFromEmployeeBusinessEvent businessEvent = BPAADImportFromEmployeeBusinessEvent::newFromHCMWorker(worker);
if(businessEvent)
{
businessEvent.send();
BPAADHCMWorkerLog::updateWorkerEmailAddr(worker,workerLog.AADEmailID) ;
}
}
}
}
}
Comments
Post a Comment