This tutorial explains how to create an action type that is backed by an Ontology Edit Function.
In this tutorial, we will use the same Demo Ticket
object type and sample objects as in the Getting Started with Actions tutorial.
Start by writing an Ontology Edit Function that performs the desired edits for your Action. This requires:
Information on these steps can be found in the Functions documentation:
Once you have written and published an Ontology Edit Function, the steps below will connect the function to an Action so that the function can be used to make edits to objects. For the purposes of this tutorial, we have written and published the following Ontology Edit Function from a repository:
For convenience, the code is available here:
Copied!1 2 3 4 5
@OntologyEditFunction() public addPriorityToTitle(ticket: DemoTicket): void { let newTitle: string = "[" + ticket.ticketPriority + "]" + ticket.ticketTitle; ticket.ticketTitle = newTitle; }
Functions for use in Action types must be annotated with @OntologyEditFunction()
instead of @Function()
. Further details can be found in the documentation for functions on objects.
In the Rules section, add a single rule of type Function. Search for the function you published as part of the prerequisites, and pick the latest version. Configure the inputs to match up to the Action parameters, as below. Note that a Function Rule cannot be combined with other rules.
When selecting the Function, all inputs of the Function will automatically be created as Parameters and added to the Forms tab. In the example shown in these screenshots, a Demo Ticket
parameter of type Object reference has been created. The parameter can now be customized further if needed.
Save your Action and configure it across the platform as described in the guidance for integration with other applications.
If the Ontology Edit Function logic is changed, the Action does not automatically update to match it. Instead, you must return to the Rules section of the Action and upgrade the version of the Function that the Action is referencing. For example, if we published 0.1.2 of our Function, we would need to update it here: