Create an employee creation intent
Create the employee of an onboarding as a task the ticket tracks, from the HR information (name, emails, phone, start date, job, legal entity, work location, teams, manager, address). Creates the intent and its EMPLOYEE_CREATION task. Without scheduleDate the employee is created right away — a real employee and Clerk user, so confirm the information first; with one, the task sleeps until that date and the employee is created when it wakes up — nobody has to execute it. A field you leave out is read from the onboarding: its HRIS record, or what the admin wrote on a manual onboarding (hire in getOnboarding), until the employee is created. A field you send, null included, is pinned: send only what differs. Pass the ticket the task belongs to as parentTicketId; without one Primo opens a ticket for it. createTicket and createTask cannot make a typed task. Returns the intent id, its taskId and the ticketId holding it. When the employee cannot be created (for instance EMPLOYEE_INFORMATION_INCOMPLETE), the task stays PENDING with an internal comment: fix the intent with updateEmployeeCreationIntent, then executeEmployeeCreationIntent. The task cannot be marked done by hand: updateTaskStatus refuses it, and it completes once Primo has created the employee. createEmployee only creates a record with no onboarding or task, and completeOnboarding closes the whole onboarding without this task; use the employee creation intent for an EMPLOYEE_CREATION task a ticket tracks. Refused with ONBOARDING_NOT_FOUND, ONBOARDING_HAS_EMPLOYEE_CREATION (the onboarding already has a live one, whose id comes back as intentId: update or execute it), MANAGER_NOT_FOUND, PARENT_TICKET_IS_TYPED or PARENT_TICKET_IS_A_TASK (pass the untyped ticket instead), PARENT_TICKET_NOT_FOUND.
Authorizations
Body
Every address of the hire, replaced whole. The employee is given the ones it does not list once created, and an address another employee holds refuses the creation. A SaaS account opened for the hire without an address takes the first of them.
20^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$First day of the employee (ISO 8601), past or future.
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$Creates the task SCHEDULED until this date: it cannot be executed before it wakes up as PENDING.
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$Response
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$When the intent was executed; null while it can still change
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$