Skip to main content

Action

An action variable is the definition of an action that can be used in a workflow

Construction

An action is a structure that contains some configuration information and some code to perform a task within a workflow and takes the following form:

actionname = action in "category"
// Description
(in name as type (description)? (optional)?)*
(out name as type (description)?)*
exit ("transition")*

(statement)*
return "transition"
end

An example of a simple greeting action:

hello_message = action in "general"
// Greets the passed-in user name
in user as Scalar
out message as Scalar
exit "ok"

output.message = "Hello " + input.user
return "ok"
end

Properties

An action has the following properties:

NameDescriptionType
categoryA category is used to group similar actions togetherScalar(String)
descriptionA description of what this action doesScalar(String)
exitsThe exit transitions from this actionList(String)
idThe ID of this actionScalar(String)
inputsThe input variable argsList(Arg)
outputsThe output variable argsList(Arg)
scriptThe actual code used to create this actionScalar(String)
versionThe version of this actionObject

Methods

An action has the following methods:

NameDescriptionReturn Type
run(in, out)Runs this action and returns the name of the exit transitionScalar(String)

Example Usage

You can run an action in ODSL code by creating an input object and an output object. The input object should contain the in arguments required by the action and the output object should be empty.

When the action runs, it populates the output object with any output arguments defined.

oi = Object()
oi.user = "World"
oo = Object()
hello_message.run(oi, oo)
print oo

This outputs:

{
"_id": "oo",
"_type": "#Object",
"_links": {},
"hello_message": {
"_id": "output",
"message": "Hello World"
}
}

Further Reading