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.
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:
Open the Function form and click the Parameters tab.
Define a MessageID input parameter with Java Data Type set to String
.
This parameter represents the name key part of the Rule-Message instance.
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.
Add a row to the Rule Type Parameters section and enter Rule-Message in the Rule Type field.
Map the MessageID input parameter to the Message Name key part.
Select the MessageParameters input parameter from the Parameter Page list.
Update the code on the Java tab to call the MessageID message and pass it the MessageParameters parameter page.
Generate and save the function.
To configure the corresponding example function alias:
Open the Function Alias form and click the Reference tab.
Enter the name of your function in the Function name field.
Select SmartPrompt
from the Prompt type drop-down list for the MessageID input parameter.
Select No Prompt (Hide)
from the Prompt type drown-list for the MessageParameters input parameter.
Enter natural language in the Pattern template field to prompt the user.
For example, Add details to Message: {MessageID}
For more information on mapping input parameters to key parts of a rule type, see Completing the Parameters tab of the Function form.
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:
Open a rule form, such as a collection or when condition, that supports function aliases.
Click and select the name of the example function alias.
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.
Click Get params and review the fields in the Parameters section.
Each row in the list represents an input parameter for the specified message.
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.
Completing the Java tab of the Function form |