Form finisher

Target group: Integrators, Developers

Configuring JobRouter®

Before you can start instances successfully you have to configure your JobRouter® installation to execute steps automatically. The command for starting instances only saves the step. To send the step you need a JobRobot configuration and add the robot user to the Job Function of the start step.

  1. Configure JobRobot module

    If you haven't an activated JobRobot configuration create a new user in your JobRouter® installation and configure it under System > Configuration > Modules > JobRobot. You see the following screen:

    JobRobot configuration

    JobRobot configuration

    After activating and saving the form the JobRobot user is available.

  2. Add JobRobot user to Job Function of start step

    Then add the robot user to the Job Function of the start step. It can then look like this:

    Robot user in Job Function of start step

    Robot user in Job Function of start step

Start instances

A form finisher JobRouterStartInstance is available to start a JobRouter® process instance. After submitting a form, the form values are stored in a transfer table. A command, hopefully executed regularly, takes these transfer records and start a process instance. This is due the fact, that a JobRouter® installation can temporarily not available due to maintenance or network problems. Also the submitting of a form on the website should be as fast as possible for a good user experience.

Start one instance

So, let's start with an example. The form finisher is defined in the YAML configuration of the specific form:

finishers:
   -
      identifier: JobRouterStartInstance
      options:
         handle: 'start_website_contact'
         type: 'Demo'
         summary: 'Demo Contact'
         # It is important to add the JobRobot username.
         # The concrete name depends on your configuration above,
         # we assume "robot" here:
         username: 'robot'
         processtable:
            name: '{preName} {lastName}'
            company: '{company}'
            email_address: '{email}'
            phone_number: '{phone}'
            message: '{message}'
            form_identifier: 'www.example.com/demo'
Copied!

As you can see, you can define some options. These are:

  • handle (required): The step handle defined in the Processes module.
  • type: The type can be used for statistical evaluation in the according dashboard widget.
  • summary: The summary of the instance.
  • initiator: The initiator of the instance.
  • username: The username the instance should be assigned to.
  • jobfunction: The Job Function the instance should be assigned to.
  • priority: The priority of the instance (number between 1 and 3).
  • pool: The pool of the instance (positive number).
  • processtable: You can map the form fields to the process table fields. As you can see in the example above, you define the process table field as the key (e.g email_address) and then map it with the to the form field identifier which is enclosed in curly brackets (e.g. {email}). You can also set a static value, combine a static value with a form field or map multiple form fields to a process table field.

Start multiple instances

It is also possible to start multiple instances – even on different JobRouter® installations. Just use the array notation in options:

finishers:
   -
      identifier: JobRouterStartInstance
      options:
         -
            handle: 'start_website_contact'
            summary: 'Demo Contact'
            username: 'robot'
            processtable:
               name: '{preName} {lastName}'
               company: '{company}'
               email_address: '{email}'
               phone_number: '{phone}'
               message: '{message}'
               form_identifier: 'www.example.com/demo'
         -
            handle: 'collect_anonymous_messages'
            summary: 'Demo Contact'
            username: 'robot'
            processtable:
               ANON_MESSAGE: '{message}'
               FROM_URL: 'https://www.example.com/demo'
Copied!

Attachments

New in version 2.0.0

One or more attachments (files) can be added to a form and processed with the JobRouterStartInstance form finisher. By default, the files are stored in the first file storage 1:/user_upload/, for example fileadmin/user_upload, but can be overwritten in your form configuration, for instance:

renderables:
  -
    # ...
    renderables:
      -
        properties:
        saveToFileMount: '3:/my_form_uploads/'
        allowedMimeTypes:
          - application/pdf
        type: FileUpload
        identifier: the_pdf_file
        label: 'The PDF file'
Copied!

In this example, the files are stored in the file storage with the ID 3, and there in a folder named my_form_uploads.

When running the "clean up transfers" command, the files are deleted alongside the according transfer records.

Variables

You can use variables in the common parameters, such as summary or initiator, and in the process table fields.

For more information have a look into the available variable resolvers. You can also write your own variable resolvers.