|
Http Verb |
POST |
|---|---|
|
Url |
/work-orders/execution/r1/interventions/{interventionId}/outcomes |
|
Permissions required |
|
|
Personally Identifiable Information (PII) |
No |
|
Sensitive Information |
No |
|
Last Modified Version |
r1 - 2025 W2 (FSM 20.0) |
|
Released since |
2024 W3 (FSM 18.0) |
|
Deprecated since |
|
|
Removed since |
|
|
Tech Tags |
|
Business Logic
This API inserts an intervention outcome starting from the intervention id.
This API manages the intervention outcome related to interventions in status not CLOSED.
To retrieve the interventionId, you can call the API GET /work-orders/execution/r1/interventions .
This API updates information related to:
-
Intervention Outcome GET /work-orders/execution/r1/interventions/outcomes/{outcomeId}
-
Work Order Operation GET /work-orders/r1/work-orders/{workOrderId}/operations
-
Work Order GET /work-orders/r1/work-orders
Steps:
We will refer to interventionFromInputId as the intervention record with intervention.id = interventionId set in path parameter of this API.
-
Few examples:
-
interventionFromInputId.workOrderOperationIdwill be theworkOrderOperationIdfield ofinterventionrecord withintervention.id = interventionIdset in path parameter of this API. -
interventionFromInputId.outcome.startDatewill be thestartDatefield of theinterventionOutcomerelated to intervention withid = interventionIdset in path parameter of this API.
-
-
Retrieve Related Intervention Records:
-
Fetch all related intervention records with
interventions.workOrderOperationId = interventionFromInputId.workOrderOperationId. -
Check if there is at least one already accounted intervention record by filtering the list:
-
interventions.startDate > startDate -
interventions.outcome.reasonIdis not null -
interventions.statusis 'CANCELLED' or 'CLOSED'
-
-
If at least one record is found, return error
ALREADY_ACCOUNTED_INTERVENTION.
-
-
Retrieve Set Dates:
-
Set Start Date:
-
If
startDateis not null, setinterventionFromInputId.outcome.startDate = startDate. -
Otherwise, get
interventionFromInputId.startDate.-
If
interventionFromInputId.startDate <= Date.now, setinterventionFromInputId.outcome.startDate = interventionFromInputId.startDate.
-
-
Check for other related interventions not yet accounted for, filtering by:
-
interventions.startDate < interventionFromInputId.startDate -
interventions.outcome.reasonIdis null
-
-
If a record is found on previous point, overwrite
interventionFromInputId.outcome.startDatewith thestartDateof the found intervention record.
-
-
Set End Date:
-
If
endDateis not null, setinterventionFromInputId.outcome.endDate = {endDate}. -
Otherwise, if
interventionFromInputId.endDate <= Date.now, setinterventionFromInputId.outcome.endDate = interventionFromInputId.endDate.
-
-
Additional validations
-
If
interventionFromInputId.outcome.startDate>interventionFromInputId.outcome.endDatereturn ERROR. -
If
interventionFromInputId.outcome.endDate> now return ERROR. -
if
interventionFromInputId.outcome.arrivalOnSiteDate is not null, if yes return ERROR. If not:-
Check if
interventionFromInputId.outcome.takeInChargeDate < interventionFromInputId.outcome.arrivalOnSiteDate. If yes return E
-
-
if
interventionFromInputId.outcome.arrivalOnSiteDate is not null, if yes return ERROR. If not:-
Check if
interventionFromInputId.outcome.arrivalOnSiteDate > interventionFromInputId.outcome.endDate.If yes, return ERROR.
-
-
if reasonId.
mandatoryEncodedNote= true:-
Check if
encodedNoteIdis null. If yes return WORKORDERS_ORCHESTRATOR_005.
-
-
-
-
Save Outcome and Update Work Order Operation and Work Order:
-
Validate Status:
-
We are managing intervention outcomes related to interventions in status not CLOSED.
-
If
interventionFromInputId.statusis not 'CLOSED' andinterventionFromInputId.workOrderOperationId.statusis 'CLOSED' or 'CANCELLED', return errorINVALID_WO_OPERATION_STATUS.
-
-
Validate Measures (FSM 20.0):
-
Loads applicable census rules for the intervention
-
Retrieves all measuring elements associated with the intervention's address
-
For interventions with census rules:
-
Identifies measuring elements based on catalog groups and characteristics defined in the census rules. A measure for a measuring element is mandatory if a rule define as mandatory a catalog group or a characteristic that a measuring element tracks.
-
Verifies that each measuring element has at least one validated measure
-
Raises an error if any mandatory measurements are missing. It is possible to view the intervention measures by calling the following API https://overit-spa.atlassian.net/wiki/spaces/NEXTGENFSMAPIS/pages/104206665233/GET+work-orders+execution+r1+interventions+interventionId+measures?atlOrigin=eyJpIjoiYWQ5MzJlMDViNDk2NGRiOWEzN2I2YjE0ZjdhODUxYmEiLCJwIjoiYyJ9 . In order to validate or reject the measure associated to the intervention, use the API https://overit-spa.atlassian.net/wiki/x/ioHyQRg or https://overit-spa.atlassian.net/wiki/x/toHyQRg
-
-
-
Save Outcome:
-
Save the API request body fields and calculated fields to
interventionFromInputId.outcome. It is possible to view them by calling this API GET /work-orders/execution/r1/interventions/outcomes/{outcomeId}
-
-
Update Work Order Operation:
-
Retrieve and update the
workOrderOperationrelated tointerventionFromInputId.workOrderOperationId:-
Status ID: Update
interventionFromInputId.workOrderOperationId.statusIdbased oninterventionFromInputId.outcome.reasonId.outcomeTypeId. -
Current Duration: Update
interventionFromInputId.workOrderOperationId.currentDuration -
Progress Percentage: Calculate and update
interventionFromInputId.workOrderOperationId.progressPercentage. -
Outcome Count: Update
interventionFromInputId.workOrderOperationId.outcomeCountby counting all related intervention records whereintervention.outcome.reasonIdis null. -
Last Outcome Intervention ID: Set
interventionFromInputId.workOrderOperationId.lastOutcomeInterventionId = interventionFromInputId -
Last Outcome Reason ID: Set
interventionFromInputId.workOrderOperationId.lastOutcomeReasonId = interventionFromInputId.outcome.reasonId. -
Last Outcome Date: Set
interventionFromInputId.workOrderOperationId.lastOutcomeDate = interventionFromInputId.endDate. -
Last Outcome Origin ID: Set
interventionFromInputId.workOrderOperationId.lastOutcomeOriginId = interventionFromInputId.originId. -
Last Outcome User ID: Set
interventionFromInputId.workOrderOperationId.lastOutcomeUserIdto the user ID of the caller.
-
-
-
Update Work Order:
-
Retrieve and update the work order related to
interventionFromInputId.workOrderOperationId:-
Last Outcome Reason ID: Set
interventionFromInputId.workOrderOperationId.workOrderId.lastOutcomeReasonId=interventionFromInputId.workOrderOperationId.lastOutcomeReasonId. -
Last Outcome Date: Set
interventionFromInputId.workOrderOperationId.workOrderId.lastOutcomeDate=interventionFromInputId.workOrderOperationId.lastOutcomeDate. -
Last Outcome Origin ID: Set
interventionFromInputId.workOrderOperationId.workOrderId.lastOutcomeOriginId=interventionFromInputId.workOrderOperationId.lastOutcomeOriginId. -
Last Outcome User ID: Set
interventionFromInputId.workOrderOperationId.workOrderId.lastOutcomeUserId=interventionFromInputId.workOrderOperationId.lastOutcomeUserId.
-
-
-
Path Parameters
|
Field |
Note |
|---|---|
|
interventionId |
|
Header Parameters
Default.
Request Body Parameters
|
Field |
Validations |
Note |
|---|---|---|
|
takeInChargeDate |
Mandatory → it can be specified in the body or by previously calling the taking-charge API POST /work-orders/execution/r1/interventions/{interventionId}/taking-charge |
|
|
arrivalDate |
Mandatory → it can be specified in the body or by previously calling the arrival-on-site API |
|
|
startDate |
Mandatory → it can be specified in the body or by previously calling the running API TODO |
|
|
endDate |
Mandatory |
|
|
reasonId |
Mandatory Referenced resource id existance check |
|
|
encodedNoteId |
Referenced resource id existance check |
|
|
validationDate |
|
|
|
validationStatusId |
Referenced resource id existance check |
|
|
notes |
Max length: 4000 |
|
|
originId |
Mandatory Referenced resource id existance check |
|
Response documentation
Response payload fields
|
Field |
Note |
Example value |
|---|---|---|
|
payload |
|
|
Response error codes
NOT_FOUND, BASE_0001, BASE_0003, BASE_0012, WORKORDERS_ORCHESTRATOR_001, WORKORDERS_ORCHESTRATOR_002, WORKORDERS_ORCHESTRATOR_005