Description
Create a new plugin that demonstrates the OFS 26A functionality introduced in plugin-core v1.6.0. This plugin will showcase form management capabilities, environment-based token retrieval, and Fusion API integration for inspection events.
Base Template
Use ./010-TokenExample as the starting point for this plugin.
Requirements
1. Context Detection (Activity vs Inventory)
The plugin must identify whether it was opened from an activity or a piece of inventory:
From Inventory:
{
"inventory": {
"invid": "21259059"
}
}
From Activity:
The message will contain the activity element with full activity data.
2. Form Workflow
- Receive
openParams containing the label of the form to be opened
- Open the form using the new 26A methods, passing:
activityId (when opened from an activity)
inventoryId (when opened from an inventory)
formLabel (from openParams)
- After form submission, retrieve the
formsSubmitted list using getSubmittedForms()
3. Token Retrieval for Fusion APIs
If a form has been submitted:
- Build the scope using the
environment getter (new in v1.6.0)
- Use
OFSEnvironment properties: environmentName, fsUrl, faUrl
- Retrieve token using
getAccessTokenByScope() procedure
- Use the token to invoke Fusion APIs
4. Fusion API Integration - Inspection Events
Step 1: Create Inspection Event
Endpoint: POST /fscmRestApi/resources/latest/inspectionEvents
Payload:
{
"EventType": "AST",
"Inline": "N",
"InspectedBy": "user@example.com",
"InspectionDate": "2025-10-18T16:48:03.777+00:00",
"OrganizationCode": "11270",
"AssetWorkOrderNumber": "OCO-10510",
"AssetNumber": "OEW-SS001-PR003",
"QuantityRequested": 1,
"OperationSequenceNumber": "10",
"AssetInspectionPlanName": "OMS305A.05Y.A.PR-CD_TEST_V2",
"WoOperationCode": "OMS305A.05Y.A.PR-CD"
}
Step 2: Get Inspection Event Details
Endpoint: GET /fscmRestApi/resources/latest/inspectionEvents
Retrieves the created event with IpEventId, Sample, SampleDisposition, and SampleResult data including SampleResultId and CharacteristicName.
Step 3: Update Inspection Results
Endpoint: PATCH /fscmRestApi/resources/latest/inspectionEvents/{IpEventId}
Payload: Updates SampleResult entries with ResultValueChar or ResultValueNumber based on form data.
5. Form-to-Characteristic Mapping
Critical Requirement: The name of the property in the OFS form must match the name of the characteristic in Quality Management. This enables automatic mapping between form fields and inspection characteristics.
Example mapping:
| Form Property |
Quality Characteristic |
Result Type |
MT 01M MAIN TANK |
MT 01M MAIN TANK |
ResultValueChar |
MT 01M OLTC COUNTER |
MT 01M OLTC COUNTER |
ResultValueNumber |
Architecture Requirements
Separation of Concerns
The Fusion API integration logic must be completely separated from the main plugin logic. This allows:
- Easy adjustment to invoke different APIs
- Reusability across plugins
- Clean testing boundaries
Suggested structure:
assets/js/
├── main.ts # Entry point
├── custom.ts # Plugin logic (context detection, form handling)
└── services/
└── fusionApi.ts # Fusion API integration (isolated)
The fusionApi.ts module should expose:
createInspectionEvent(token, payload)
getInspectionEvent(token, eventId)
updateInspectionResults(token, eventId, results)
New v1.6.0 Features to Demonstrate
Acceptance Criteria
Labels
- enhancement
- 26A
- fusion-api
Description
Create a new plugin that demonstrates the OFS 26A functionality introduced in plugin-core v1.6.0. This plugin will showcase form management capabilities, environment-based token retrieval, and Fusion API integration for inspection events.
Base Template
Use
./010-TokenExampleas the starting point for this plugin.Requirements
1. Context Detection (Activity vs Inventory)
The plugin must identify whether it was opened from an activity or a piece of inventory:
From Inventory:
{ "inventory": { "invid": "21259059" } }From Activity:
The message will contain the
activityelement with full activity data.2. Form Workflow
openParamscontaining the label of the form to be openedactivityId(when opened from an activity)inventoryId(when opened from an inventory)formLabel(from openParams)formsSubmittedlist usinggetSubmittedForms()3. Token Retrieval for Fusion APIs
If a form has been submitted:
environmentgetter (new in v1.6.0)OFSEnvironmentproperties:environmentName,fsUrl,faUrlgetAccessTokenByScope()procedure4. Fusion API Integration - Inspection Events
Step 1: Create Inspection Event
Endpoint:
POST /fscmRestApi/resources/latest/inspectionEventsPayload:
{ "EventType": "AST", "Inline": "N", "InspectedBy": "user@example.com", "InspectionDate": "2025-10-18T16:48:03.777+00:00", "OrganizationCode": "11270", "AssetWorkOrderNumber": "OCO-10510", "AssetNumber": "OEW-SS001-PR003", "QuantityRequested": 1, "OperationSequenceNumber": "10", "AssetInspectionPlanName": "OMS305A.05Y.A.PR-CD_TEST_V2", "WoOperationCode": "OMS305A.05Y.A.PR-CD" }Step 2: Get Inspection Event Details
Endpoint:
GET /fscmRestApi/resources/latest/inspectionEventsRetrieves the created event with
IpEventId,Sample,SampleDisposition, andSampleResultdata includingSampleResultIdandCharacteristicName.Step 3: Update Inspection Results
Endpoint:
PATCH /fscmRestApi/resources/latest/inspectionEvents/{IpEventId}Payload: Updates
SampleResultentries withResultValueCharorResultValueNumberbased on form data.5. Form-to-Characteristic Mapping
Critical Requirement: The name of the property in the OFS form must match the name of the characteristic in Quality Management. This enables automatic mapping between form fields and inspection characteristics.
Example mapping:
MT 01M MAIN TANKMT 01M MAIN TANKResultValueCharMT 01M OLTC COUNTERMT 01M OLTC COUNTERResultValueNumberArchitecture Requirements
Separation of Concerns
The Fusion API integration logic must be completely separated from the main plugin logic. This allows:
Suggested structure:
The
fusionApi.tsmodule should expose:createInspectionEvent(token, payload)getInspectionEvent(token, eventId)updateInspectionResults(token, eventId, results)New v1.6.0 Features to Demonstrate
OFSEnvironmentinterface (environmentName,fsUrl,faUrl)environmentgetter on OFSPlugin classgetAccessTokenByScope()procedurecloseAndOpenForm()methodgetSubmittedForms()procedureBackScreenenum usageAcceptance Criteria
Labels