Aller au contenu
Agentivity
Star on GitHub Commencer gratuitement

Ask a person to fill in a form

Ce contenu n’est pas encore disponible dans votre langue.

A question with one free answer is sometimes not enough. A form asks for several values at once, each in its own field. The workflow stops, a person fills in the form, and the workflow continues with the values.

For one question and one answer, use the simpler step: Ask a person to approve or answer.

  1. In the Nodes catalog, open Interactions and drag Form Interaction onto the canvas.
  2. Open AI > Interactions and drag Forms Channel onto the canvas, below the step. It appears as a circle.
  3. Drag from the diamond of Forms Channel to the diamond under Form Interaction.
  4. Link Form Interaction to the step that must run after the form.
  1. Right-click Form Interaction and select Edit.
  2. In Title, type the title of the form.
  3. In Description, say what the person must do.
  4. Under Fields, describe the fields: one block for each field. See the next section.
  5. Select Apply, then Publish.

The window of the Form Interaction node: the title, the description, and under Fields one block for each field, with its Name, its Label, its Type, the switch Required and its Hint, and the button Add a field

Under Fields, each field is a block with its Name, its Label, its Type (chosen in a list), the switch Required and a Hint. Select Add a field to add one, and the bin at the top right of a block to remove it.

Behind the window, the fields are saved as a list in a format named JSON, which is also the form of an API call. This example shows the same three fields as such a list:

[
{ "name": "customer", "label": "Customer", "type": "Text", "required": true },
{ "name": "amount", "label": "Amount due", "type": "Number", "required": true },
{ "name": "send", "label": "Send the reminder", "type": "Boolean" }
]

What each part means:

PartWhat it is
name (Name)The name of the field for the workflow. Lower case, no space. The next steps use this name.
label (Label)What the person reads next to the field.
type (Type)The kind of value. See the list below.
required (Required)true if the person must fill in the field. A field with no required is required.
hint (Hint)A short help text. It is optional.
defaultValueA value already filled in, which the person can keep or change. It is optional.
optionsFor a field of type Choice: the list of choices, each between quotation marks.

The types:

TypeThe person enters
TextOne line of text.
MultilineTextSeveral lines of text.
NumberA number.
BooleanYes or no.
ChoiceOne of the choices you listed in options.
DateA date.
FileA file.

In an API call, write the types exactly as shown, with their capital letters.

After the person submits the form, the step produces:

OutputWhat it holds
One output per field, with the name of the fieldThe value the person entered. In the example: customer, amount and send.
response_dataAll the values together.
outcomeThe result of the form, for example Submitted.
responded_byWho answered.

For example, link an If step after the form, and test the output send. See Add a condition to a workflow.

  1. Run the workflow. See Run a workflow and follow each step.
  2. The workflow stops at the form. In the section Executions, the execution has the label ACTION REQUIRED.
  3. In the Execution view of the workflow, open the tab Forms in the panel on the right, fill in the form and submit it.
  4. The execution continues and reaches the state completed.
  • The step fails, or the form has no field. Check that each field has a Name and a Type. In an API call, check the commas, the quotation marks and the curly braces of the list, and the spelling of each type.
  • The workflow does not stop. Check that Forms Channel is plugged into the diamond of the step.
  • A field cannot be left empty. A field is required unless you write "required": false.
  • An agent can ask for a form too, by itself, when it has a Forms Channel. See Let an agent ask a person before it decides.
  • In the Community edition there is no login, so Agentivity does not check who fills in the form.

Add a condition to a workflow.