I am getting the below enriched message for each user ID after querying EmpTime from the SF system for yesterdayDate(02/07/2021).
<EmpJob> <EmpJob> <userId>1000001</userId> <EmployeeTime> <externalCode>100000120210611</externalCode> <endDate>2021-07-01T00:00:00.000</endDate> <userId>1000001</userId> <startDate>2021-07-01T00:00:00.000</startDate> </EmployeeTime> </EmpJob> </EmpJob> <EmpJob> <EmpJob> <userId>1000002</userId> </EmpJob> </EmpJob> <EmpJob> <EmpJob> <userId>1000003</userId> </EmpJob> </EmpJob> <EmpJob>
If EmployeeTime is node not there, I have to query that userID again(1000002 and 1000003 from the above message) for a day before yestrdayDate(01/07/2021). I have to do this until unless userID has EmployeeTime.
I have written groovy which replaces the yestrdayDate to previousDate after every loop. I can collect lastDate and userID which has the EmployeeTime from this groovy for further processing of mapping.
But, looping is not working coz of the condition I maintained. I have tried the below values in looping process call to check if EmployeeTime exists. But, no luck.
Any leads will be really helpful.