Geocortex Web has many built-in Commands and Operations which can be chained together to build custom behaviors with. If these commands and operations are not enough to accomplish your goal, you can use Geocortex Workflow to take custom behavior even further without writing custom code. If Workflow is still not enough to accomplish your needs, then it might be time to implement a custom command or operation.
This article will walk you through implementing a custom command in Geocortex Web that can record actions and a custom operation that returns a list of the executed actions.
- Download and setup the Geocortex Web SDK.
- Check out the deployment instructions to learn more about deploying custom code to a Geocortex Web App.
Create a new folder structure with the following files. These files define a new service and export it from the
Learn more about implementing custom services
Every service needs to be registered with the Web SDK in order to be discovered and initialized.
- Add a call to
Commands and operations are registered in
serviceId of the command or operation registration must match the
id used in the
It's now time to implement the command to record an action, and the operation that returns a history of executed actions in the
CustomService. We can define each command and operation with an appropriately named
protected method that is decorated with
You can test your custom command and operation by adding entries to the I Want to Menu in the app config that run your commands and operation. For more information on customizing your app with commands and operations, see commands and operations.
The following app config and layout adds three entries to an I Want To Menu that run the custom commands and operations implemented in this article. The operation
custom-service.get-action-history has been slightly changed to return an argument that is compatible with the inputs of
- App Config
- Custom Service
Check out a live SDK sample that demonstrates implementing custom commands and operations.
Commands and operations are the logical building blocks of executing custom behavior in Geocortex Web, but sometimes you need to take things a bit further. Creating custom components can allow you to design completely custom UI for Geocortex Web, and creating services can enable shared logic and background tasks.
Commands and Operations
Learn more about creating custom commands and operations
Implement a Custom Component with UI
Learn how to implement a custom component using the Geocortex Web SDK
Learn more about custom services