Gathering user input by using choice messages in automation scripts

A choice message gathers user input, which can then be used in the automation script. You can use choice messages in automation scripts to create an interactive user experience. For example, a message can say that a record does not exist and ask if the record should be created.

You can define choice messages in the Database Configuration application. The buttons that you can use on a choice message are OK, Close, Cancel, Yes, and No. You can use curly brackets {} to insert variables into the choice message. For example, in the Labor text field, a user can enter the name of a person, but that person must have a person record. If a person record does not exist, the user receives the following error message: A person record does not exist for {0}. Would you like to create one?

You can use choice messages in automation scripts that are associated with action launch points, the Validate Value event for an attribute launch point or the Run Action event for an attribute launch point. Typically, an automation script that is associated with an attribute launch point presents a choice message to users. Such an automation script must contain code that triggers the display of a choice message, retrieves the user's choice, and performs the selected action for the user's choice.

When you write an automation script that uses a choice message, you first declare the functions that define the business logic that is necessary to process the user input. Then, you link the user input to the appropriate functions. Finally, you implement the business logic checks that are performed so that the user input is retrieved and applied to the dictionary to run the appropriate function.

One of the business logic checks that you can perform is to use the interaction implicit variable to check that the situation is interactive. This implicit variable takes a Boolean value of either true or false. If true, the script code is run in the context of an application user interface. If false, the script code is run from a backend service, from a component loading data through the integration framework, or from a cron task.