How to use parameter pages with a function alias

You can create a function that uses parameter pages to pass information to other rules, such as activities or data transforms, that support parameters. You can then define natural-language prompting for the values on these parameter pages, using a function alias.

Using parameter pages and function aliases is a powerful technique that allows you to build robust functions that are accessible to non-technical users.

Creating the required rules

You need to create and configure a function and a corresponding function alias before you can pass any parameters. You also need to know ahead of time how many input parameters the function requires.

For example, your function can update a Rule-Message instance. Messages use parameters to combine dynamic and static text. Therefore, your function requires two input parameters: the ID of the message to update and a parameter page that contains the dynamic text.

To configure this example function:

  1. Open the Function form and click the Parameters tab.
  2. Define a MessageID input parameter with Java Data Type set to String. This parameter represents the name key part of the Rule-Message instance.
  3. Define a MessageParameters input parameter with Java Data Type set to ParameterPage. This parameter represents the clipboard page your function passes to the message at run time.
  4. Add a row to the Rule Type Parameters section and enter Rule-Message in the Rule Type field.
  5. Map the MessageID input parameter to the Message Name key part.
  6. Select the MessageParameters input parameter from the Parameter Page list.
  7. Update the code on the Java tab to call the MessageID message and pass it the MessageParameters parameter page.
  8. Generate and save the function.

To configure the corresponding example function alias:

  1. Open the Function Alias form and click the Reference tab.
  2. Enter the name of your function in the Function name field.
  3. Select SmartPrompt from the Prompt type drop-down list for the MessageID input parameter.
  4. Select No Prompt (Hide) from the Prompt type drown-list for the MessageParameters input parameter.
  5. Enter natural language in the Pattern template field to prompt the user. For example, Add details to Message: {MessageID}
  6. Save the function alias.

For more information on mapping input parameters to key parts of a rule type, see Adding traceability to a function.

Passing parameters to a function alias

When you call a properly configured function alias from a supported rule type, the system prompts you to pass input parameter values to the underlying function. Once you enter these values, you can click the Get params button to pass a parameter page with additional values.

To call the example function alias:

  1. Open a rule form, such as a collection or when condition, that supports function aliases.

  2. Click the Down arrow icon and select the name of the example function alias.

  3. Use the SmartPrompt to enter the name of a Rule-Message instance in your application that has at least one input parameter defined.

    The value you enter represents the MessageID input parameter for the underlying function.

  4. Click Get params and review the fields in the Parameters section.

    Each row in the list represents an input parameter for the specified message.

  5. Enter message text in the fields in the Parameter Value column.

    The values you enter represent the MessageParameters input parameter for the underlying function.

At run time, the function alias passes the values stored in MessageID and MessageParameters to the underlying function. The Java code in the function then uses the MessageID to find the appropriate Rule-Message instance. It passes the MessageParameters clipboard page to the message and your dynamic text is incorporated into the pyMessageText of the message rule.

Note: The Get params button is visible when the function alias that you are calling is associated with a function that has input parameters mapped to rule types.