I’m working on a project where I need to fetch employee attendance data from an API and store it in a Daily Attendance data type. The structure of my Daily Attendance data type is shown in the image below:
The API I’m using returns data in the following format:
{
“result”: [
{
“attendanceDetails”: {
“2024-08-27”: {
“ShiftStartTime”: “12:00 AM”,
“Status”: “Present”,
“FirstIn_Building”: “-”,
“OverTime”: “02:00”,
“LastOut_Location”: “",
“ShiftName”: “General”,
“FirstIn”: “27-Aug-2024 10:51 AM”,
“FirstIn_Location”: "”,
“TotalHours”: “10:00”,
“Late_In”: “10:51”,
“WorkingHours”: “08:00”,
“LastOut_Building”: “-”,
“LastOut”: “27-Aug-2024 10:27 PM”,
“Early_Out”: “01:33”,
“ShiftEndTime”: “12:00 AM”
}
},
“employeeDetails”: {
“mail id”: “",
“erecno”: "”,
“last name”: “",
“first name”: "”,
“id”: “*****”
}
}
// More employee data here
]
}
Problem Description:
- I have added two date pickers (
Date A and Date B) on my page to allow users to select a start date and an end date.
- After clicking the Fetch button, I want to fetch all employees’ attendance data between the selected dates using my API and store this data into my Daily Attendance table.
Currently, I’m facing two challenges:
- How to store the correct date from the API data: In my current setup, I mistakenly use the current date for storing the attendance, but I need to use the specific date from the API response (e.g.,
2024-08-27 for each employee’s attendance on that day).
- Storing multiple employee records: I have multiple employees in the API response, and I want to create a new record for each employee in the Daily Attendance data type. The data should include details like:
- Employee email
- Attendance status (Present/Absent)
- Total working hours
- The correct date (fetched from the API response for each employee).
Here is an example of the expected behavior:
- Start Date (
A): 09/27/2024
- End Date (
B): 09/29/2024
- The system should fetch the attendance details of all employees between these two dates (09/27/2024, 09/28/2024, and 09/29/2024) and store the corresponding data for each employee for each day.
Current Setup:
I have created two workflows so far:
- Fetch Attendance Report:

3.Create New Daily Attendance Record:
Question:
- How can I adjust my workflow to store the correct date for each employee’s attendance based on the date in the API response (rather than using the current date)?
- How do I loop through the API response to create a new record for each employee and store their details in my Daily Attendance table?
Thank you for your help!