Skip to content

Martini Services Function Step

Overview

The Function Step lets you invoke any of Martini's built-in functions — or your own custom functions — as a step inside a service. It wraps the function call in the familiar Mapper interface so you can wire service properties to function inputs, capture return values, and keep complex logic organized without writing boilerplate code.

The Function Step reduces repetitive code and makes service logic easier to read, test, and maintain by treating every function call as a self-contained, visually mapped unit.

What You Will Learn

After reading this guide, you'll know how to:

  • Add a Function Step to a service
  • Use the Mapper’s Input Panel to map inputs and the Output Panel to map function results back to service properties
  • Inspect property configuration details such as default values, nullability, allowed choices, and more

When To Use This

Use the Function Step when you need to:

  • Call a Martini built-in utility (string manipulation, HTTP, JSON parsing, logging, and more) at a specific point in your service logic
  • Invoke a custom Groovy function you or your team have deployed to a Martini package
  • Reuse the same function in multiple places in a service without duplicating code

Prerequisites

Before adding a Function Step, make sure you have the following in place:

Adding a Function Step to Your Service

Martini gives you four ways to add a Function Step. Each method ends with the same result: a Function Step visible on the service canvas, ready to be configured in the Mapper. Choose whichever fits the way you’re currently working.

Using the Functions View

The Functions view lets you browse and search all available built-in functions and drag them directly onto the canvas.

  1. Open the Functions view.
  2. In the search bar, type the name of the function you want to invoke.
  3. Drag and drop your target function from the search results onto the canvas of the service editor.

Note: Only built-in functions appear in the Functions view. Custom functions are not listed here — use the Navigator view to find them instead.

Expected result: The function appears as a Function Step on the service canvas.

Using the Service Toolbar

  1. In the service editor toolbar, click the Add button.
  2. Select Function from the menu.
  3. In the search dialog, type the name of the function you want to invoke.
  4. From the search results, double-click the function to add it, or select it and press .

Note: Custom functions do not appear in the toolbar search dialog.

Expected result: The Function Step is added to the canvas at the current line position.

Using the Keyboard Shortcut

  1. With the service canvas focused, press +
  2. In the search dialog, type the name of the function you want to invoke.
  3. Double-click the function in the search results, or select it and press .

Note: Custom functions do not appear in the keyboard shortcut search dialog.

Expected result: The Function Step is inserted at the current canvas position.

Using Content-Assist

Content-assist is the only method that also finds custom functions.

  1. On the service canvas, press (period) to open content-assist.
  2. Type the name of the function you want to invoke.
  3. Double-click the function in the search results, or select it and press .

Expected result: The Function Step is added to the canvas. Both built-in and custom functions are included in content-assist results.

Configuring the Function Step Mapper

The Mapper is where you connect your service's data to the function and retrieve its result. Open it by double-clicking the Function Step on the canvas, or right-clicking and selecting Open Mapper .

The Mapper opens at the bottom of the service editor and contains two panels side by side.

Wiring Inputs with the Function Step Input Panel

The Input panel (left side of the Mapper) is where you supply values to the function's input properties — the equivalent of passing arguments to a method.

  • The left column shows your current service's properties available at this step.
  • The right column shows the function's input properties.

You have two ways to provide values:

  • Map lines — Drag a service property from the left column onto a function input property in the right column to connect them directly.
  • Set expressions — Double-click or right-click a function input property and choose Set Expression to enter a hard-coded value or an expression.
graph LR
    subgraph panel["Input Panel"]
        direction LR
        subgraph left["Current Service Properties"]
            sp1["serviceProperty1"]
            sp2["serviceProperty2"]
        end
        subgraph right["Function Input Properties"]
            ip1["inputProperty1"]
            ip2["inputProperty2"]
        end
        sp1 --> ip1
        sp2 --> ip2
    end

Capturing Output with the Function Step Output Panel

The Output panel (right side of the Mapper) is where you access the value the function returns.

  • The left column shows the function's output property — equivalent to what a method returns.
  • The right column shows your service's current properties.

You have three ways to capture the return value:

  • Map lines — Drag the function's output property from the left column onto an existing service property in the right column.
  • Drag to create — Drag the function's output property to an empty area in the right column to automatically create a new service property pre-mapped to the output.
  • Set expressions with $gloopOutput — When you use a set expression on the right side instead of a map line, the function's return value is wrapped in a $gloopOutput data model. Access the return value as $gloopOutput.outputPropertyName.
graph LR
    subgraph panel["Output Panel"]
        direction LR
        subgraph left["Function Output Properties"]
            op["outputProperty"]
        end
        subgraph right["Current Service Properties"]
            sp1["serviceProperty1"]
            sp2["serviceProperty2"]
            sp3["newServiceProperty3"]
        end
        op --> sp3
    end

Inspecting Function Property Configuration

Many built-in functions include additional details for their properties beyond the inline comments shown in the Mapper.

To inspect a property in more detail:

  • Right-click the property and select Show Configuration to open the Configuration view.

Depending on the property, the Configuration view can include details such as:

Detail Description
Default value The value used when no input is mapped
Allow null Whether null is accepted as a valid input
Choices A fixed list of allowed values
Object class name The Java class expected for Object-type properties

For more information about property configuration options, see Data Model Property Types.

Troubleshooting Function Step Issues

Problem Detection Cause Fix
Function present in JavaDoc is not searchable in Functions view Function is not found in Functions view or toolbar search Function is either (a) a hidden method not intended for service/workflow use (e.g., meant for Groovy classes), or (b) has been deprecated and hidden in newer Martini Designer versions Check the JavaDoc for the function. If it is marked as deprecated, use the recommended replacement method. If the function is hidden, use it in a Groovy class.

Helpful Resources