Overview
The flow retrieves a list of users and, if the list is not empty, iterates through each user while calling two APIs to fetch manager and user information. For each user, it checks if the user already exists in the records. If the user exists, it compares the values from the webhook with the datastore, proceeding without changes if there is no mismatch and updating the information if there is a mismatch. If the user does not exist, it creates a new user entry. If a manager ID is provided, it is used during both the creation and update processes to map the user to their manager; if no manager ID is provided, the user is created without a manager mapping. The system also checks for the user's role, iterating through the role list if the role exists, and ending the flow if it does not. An email is sent to inform relevant parties about the new hire. This process ensures accurate user management and proper notification for new hires.