Trip Status Workflow
This page documents the updated trip lifecycle shown in the workflow diagram. The model removes the old Upcoming and In Progress states and keeps a single post-approval status: Approved.
Overview
The trip workflow starts with company-level routing:
- A trip is created.
- If the company does not use trip proposals, the workflow is not applicable.
- If the company uses trip proposals but does not use expenses, the trip follows the standard flow.
- If the company uses both trip proposals and expenses, the trip follows the expense flow.
Status Definitions
| Status | trips.status enum | Meaning |
|---|---|---|
Pending | 0 (pending) | Trip proposal was submitted and is waiting for approval. |
Approved | 1 (approved) | Trip was approved and the trip end datetime has not passed yet. |
Awaiting Re-declaration | Derived, not stored in trips.status | Trip end has passed and the system is waiting for the employee to re-declare, if re-declaration is enabled. |
Pending Re-declaration | Derived, not stored in trips.status | Re-declaration was submitted and is waiting for approver action. |
Awaiting Expense | Derived, not stored in trips.status | The trip is waiting for expense submission and reimbursement processing. |
Completed | Derived, not stored in trips.status | The trip is finished and no further action is required. |
Rejected | 2 (rejected) | The trip proposal or re-declaration was rejected. |
Canceled | 3 (canceled) | The trip was canceled before completion. |
Confirmed | 4 (confirmed) | The trip was confirmed and is ready to continue through the applicable workflow. |
Type Definitions
| Type | trips.type enum | Meaning |
|---|---|---|
Personal | 0 (personal) | Personal trip. |
Business | 1 (business) | Business trip. |
Date-Based Completion Rule
For the standard flow, a trip becomes Completed when:
current_datetime > trip_end_datetime
Status calculation rules:
Pending: waiting for approval.Approved:trip_end_datetimehas not passed.Completed:trip_end_datetimehas passed.Rejected: rejected by the approver.Canceled: canceled before completion.
Use the full datetime value, including time and timezone, when evaluating completion.
Flow 1: Standard Trip Flow
This flow applies when trip proposals are enabled and expenses are not used.
Transitions
- Submission creates a trip in
Pending. - If the approver accepts the proposal, the trip moves to
Approved. - While the trip end datetime has not passed, the trip stays
Approved. - After the trip end datetime passes, the trip moves to
Completed. - If the approver rejects the proposal, the trip moves to
Rejected. - If the employee edits and resubmits after rejection, the trip re-enters the approval flow.
Key Point
In the standard flow, there is only one post-approval state before completion:
Pending -> Approved -> Completed
If rejected, the path is:
Pending -> Rejected
Flow 2: Expense Flow With Re-declaration Enabled
This flow applies when the company uses expenses and requires re-declaration after the trip ends.
Transitions
- The trip is first approved and remains
Approvedwhile the trip end datetime has not passed. - Once the trip end datetime passes, the trip moves to
Awaiting Re-declaration. - If the employee does not re-declare, the trip remains in
Awaiting Re-declaration. - If the employee submits a re-declaration, the trip moves to
Pending Re-declaration. - If the approver rejects the re-declaration, the trip moves to
Rejected. - If the approver accepts the re-declaration, the trip moves to
Awaiting Expense. - After expense submission and reimbursement, the trip moves to
Completed.
Journey Summary
Successful path:
Pending -> Approved -> Awaiting Re-declaration -> Pending Re-declaration -> Awaiting Expense -> Completed
Rejected path:
Pending -> Approved -> Awaiting Re-declaration -> Pending Re-declaration -> Rejected
Flow 3: Expense Flow With Re-declaration Disabled
This flow applies when the company uses expenses but does not require re-declaration.
Transitions
- The trip is approved and remains
Approvedwhile the trip end datetime has not passed. - After the trip end datetime passes, the trip moves directly to
Awaiting Expense. - Once expenses are submitted and reimbursement is processed, the trip moves to
Completed.
Journey Summary
Pending -> Approved -> Awaiting Expense -> Completed
Routing Rules
Use these rules to determine which flow applies:
- If trip proposals are disabled, the trip proposal workflow does not apply.
- If trip proposals are enabled and expenses are disabled, use the standard trip flow.
- If trip proposals are enabled and expenses are enabled, use an expense flow.
- If expenses are enabled, re-declaration settings determine whether the trip goes through
Awaiting Re-declarationandPending Re-declarationbeforeAwaiting Expense.
Implementation Notes
- Do not manually mark trips as
Completedin the standard flow. Completedshould be derived dynamically or by scheduled recalculation based on trip end datetime.RejectedandCanceledare terminal states until the employee submits a new or edited request.- All comparisons against trip end must use the full datetime value rather than only the calendar date.