Audience: Developers, System integrators
This topic explains how custom code adds buttons, tabs, and behaviour to the Field Execution module without modifying the standard product.
Available starting from NextGen Geo 5.0.0
Prerequisites
Before you start:
-
Read how extension points work in NextGen Geo. See Extensibility.
-
Ensure the Field Execution module is configured and can be opened. See Configure the Field Execution module.
Understand the events of the module
The module both announces what the user is doing and accepts configuration from custom code. Events whose name reads as a fact — workOrderSelected — are fired by the module and listened to by the custom code. Events whose name reads as an instruction — registerButtons — are fired by the custom code and listened to by the module.
|
Event |
Direction |
Purpose |
|---|---|---|
|
|
Module → custom code |
A work order detail card has been opened. |
|
|
Module → custom code |
A row of the work order list has been clicked. |
|
|
Custom code → module |
Adds buttons to the main toolbar of the module. |
|
|
Custom code → module |
Adds or replaces the tabs of the work order detail panel. |
|
|
Custom code → module |
Hides parts of the interface. |
|
|
Custom code → module |
Opens the detail card of a work order. |
|
|
Custom code → module |
Returns the module to the work order list. |
Note: Every configuration event accepts an optional moduleName. When it is left out, the configuration is applied to every Field Execution module instance.
Add custom buttons to the toolbar
Buttons registered this way are added to the main toolbar of the work order list, next to the standard New Work Order button, and are typically used to act on the current selection.
To add a button to the toolbar:
-
Listen for the event that tells you the module is showing a work order — for example
fieldExecution->workOrderSelected— or fire the registration when your own code is initialised, while the module is open. -
Fire
fieldExecution->registerButtonswith the buttons to add.
GeoWeb.instance.fireEvent('fieldExecution->registerButtons', {
moduleName: 'my_field_execution_module',
customButtons: [
{
xtype: 'button',
text: 'Send to dispatcher',
iconCls: 'md-icon md-icon-send',
handler: function () {
// ...
}
}
]
});
|
Property |
Input type |
Mandatory |
Description |
|---|---|---|---|
|
|
String |
No |
Name of the Field Execution module the buttons belong to. Omit it to apply them to every Field Execution module. |
|
|
Array |
Yes |
Button configurations, added to the toolbar in the order they are declared. |
Note: The buttons are added to the toolbar as they are declared: their enabled state, their tooltip, and what they do with the current selection are the responsibility of the custom code.
Add or replace the tabs of the work order detail
To add tabs to the detail panel of a work order:
-
Listen for
fieldExecution->workOrderSelected, which carries the module name and the code of the work order that is being opened. -
Fire
fieldExecution->workOrderTabswith the tabs to display.
|
Property |
Input type |
Mandatory |
Description |
|---|---|---|---|
|
|
String |
No |
Name of the Field Execution module. Omit it to apply the tabs to every Field Execution module. |
|
|
Boolean |
No |
Set to |
|
|
Object |
No |
The tabs to add, keyed by tab name. |
Hide parts of the interface
Fire fieldExecution->functionalities to hide capabilities that do not apply to a deployment — for instance, a read-only installation where work orders are created in NextGen FSM only.
|
Property |
Input type |
Mandatory |
Description |
|---|---|---|---|
|
|
String |
No |
Name of the Field Execution module. Omit it to apply the configuration to every Field Execution module. |
|
|
Boolean |
No |
Set to |
|
|
Boolean |
No |
Set to |
|
|
Boolean |
No |
Set to |
Note: Hiding the creation button is a presentation choice, not a permission. Permissions stay defined on the user profile. See Users and permissions.
Drive navigation from custom code
Two events move the module between its cards, so that custom code — a button of its own, an external notification, a selection made elsewhere in the application — can bring the user where the action belongs.
To open a work order:
Fire fieldExecution->forceOpenWorkOrder with workOrderId, the identifier of the work order, and extensionMetadata, the extension metadata to render its custom fields with.
To go back to the list:
Fire fieldExecution->forceReturnToWorkOrderList.
What's next
-
To declare the customer-specific fields the module displays, see Manage entity metadata.
-
To configure which fields appear in the filters, the list, and the detail view, see Configure the Field Execution module.