Skip to content

Input Dialog

Type: input-dialog  ·  Package: UI Activities v1.0.4  ·  Output: string

Shows a dialog with a text field and returns the value the user types. It is used to ask for a piece of data at the start or in the middle of an assisted automation: a document number, a date, a path.

It shows a Windows window centered on the screen, with the prompt text above an input field (pre-filled with default, if you set it) and the Aceptar (OK) and Cancelar (Cancel) buttons. It waits with no time limit for the person to answer:

  • Aceptar (or the Enter key) returns the text in the field as it was left; it can be "" if it was left empty.
  • Cancelar, the Esc key or closing the window return null and log a warning: Dialog cancelled by the user.

It needs an interactive Windows desktop: it does not work when the Agent runs as a Windows service (Session 0) or on robots without a user interface.

ParameterTypeDefaultDescription
promptstring—Label text above the field. Fixed text in quotes or an expression. About two lines fit.
ParameterTypeDefaultDescription
titlestring"Zoan Automation"Window title.
defaultobject""Initial value pre-filled in the field. It can be of any type: it is shown as text.
TypeDescription
stringThe text the user entered when clicking Aceptar ("" if left empty), or null if they cancelled or closed the window.

The value is always text: if you ask for a number, convert it (for example with num(...)) before using it.

Ask for a customer number, stop if the person cancels, and use it in a query:

Input Dialog prompt = "Customer number:" title = "Balance lookup" → output: number
If condition = isEmpty(number) // empty or cancelled
└─ then:
Throw message = "No customer number was entered." errorType = "BusinessRuleException"
DB Query sql = "SELECT * FROM Customers WHERE Number = @n" params = { "n": number } → output: customer
MessageCause and fix
Could not show the input dialog. UI activities (input-dialog, message-box) require an interactive desktop and do not work when the Agent runs as a Windows service (Session 0). …There is no desktop to show the window on. Run the Agent in an interactive Windows session, or replace the dialog with a process input argument.
The execution keeps waitingThe dialog waits for an answer with no time limit. Use it only when a person is in front of the screen.
The next query fails with nullThe person cancelled. Check isEmpty(number) (true for null and for empty text) before using the value.
  • Message Box — show a message or ask for confirmation.
  • Throw — stop the process if the data is missing.