here the first workflow is used for to fetch the detials from API accoring to given URL parameters. and second workflow is used for to store all the emmployees details into my Daily attendance table.But as i have shown that in databse their is not storing employees details which was fetched from api.So can anyone help me where is actually issue?
I think as second step you should schedule a workflow on a list based on a API workflow that creat your thing
How can i do that?
how does your “daily attendance” datatype look like? if it’s one (daily attendance) thing you’re creating you don’t need scheduling but if you’re storing each employee’s info as a thing then yes. Here’s how to schedule.
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
andDate 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!
Thanks for explaining so clearly, so you are getting all employee’s attendance records as a list; in this case you should schedule an API workflow on a list (the API response) to create a new Daily Attendance for each record. Check the link I shared earlier
to learn how to do it. I also wrote a blogpost tutorial that includes this case, skip to recursive workflows to find this case. If you need coaching, I’m happy to help. let me know.
can i do it with my Free plan?