Registration

The registrations module is invoked when a form submission is completed, and is responsible for persisting the form data to a configured backend. It’s arguably the most important step in the process, as this is where Open Forms does the handover to another system to process the customer request.

Python API

Module interface

The module-level API serves as an abstraction over the various plugins.

openforms.registrations.service.plugin_allows_json_schema_generation(backend: str, options: dict) bool

Indicate whether the plugin allows generating a JSON schema.

Parameters:
  • backend – The backend identifier.

  • options – Backend options.

openforms.registrations.service.process_variable_schema(component: Component, schema: JSONObject, backend_id: str, backend_options: dict, configuration_wrapper: FormioConfigurationWrapper)

Process a variable schema according to the given registration backend.

Parameters:
  • component – Formio component configuration of the variable.

  • schema – JSON schema of the variable.

  • backend_id – Backend identifier.

  • backend_options – Backend options. Note: there is no check to ensure the options are valid and correspond to the provided backend_id, so please ensure that they do.

  • configuration_wrapper – Formio configuration wrapper.

Plugin interface

Registrations plugins must inherit from the base plugin.

Plugin base API

class openforms.registrations.base.BasePlugin(identifier: str)
static allows_json_schema_generation(options: OptionsT) bool

Indicate whether the plugin allows generating a JSON schema.

camel_case_ignore_fields = None

Iterable of JSON keys to ignore when converting between snake_case/camelCase.

configuration_options

A serializer class describing the plugin-specific configuration options.

A plugin instance is the combination of a plugin callback and a set of options that are plugin specific. Multiple forms can use the same plugin with different configuration options. Using a serializer allows us to serialize the options as JSON in the database, and de-serialize them into native Python/Django objects when the plugin is called.

alias of EmptyOptions

get_custom_templatetags_libraries() list[str]

Return a list of custom templatetags libraries that will be added to the ‘sandboxed’ Django templates backend.

get_variables() list[FormVariable]

Return the static variables for this registration plugin.

pre_register_submission(submission: Submission, options: OptionsT) PreRegistrationResult

Perform any tasks before registering the submission

For plugins where the registration backend does not generate a reference number, no need to implement this method.

process_variable_schema(component: Component, schema: JSONObject, options: OptionsT, configuration_wrapper: FormioConfigurationWrapper)

Process a variable schema for this registration plugin.

update_registration_with_confirmation_email(submission: Submission, options: OptionsT) dict | None

Update the registered submission with a confirmation email.

Should be overridden by subclasses.

verify_initial_data_ownership(submission: Submission, options: OptionsT) None

Check that the submission user is the owner of the registration target.

Registration backends can possibly update existing objects, which are referenced through submission.initial_data_reference. These plugins must check that the submission user is actually the ‘owner’ of this object. For example, a permit request may have a BSN stored, or a case can have an initiator/authorizee identified by a BSN/Chamber of Commerce number.

Parameters:
  • submission – an active Submission instance.

  • options – the deserialized plugin configuration options.

class openforms.registrations.base.EmptyOptions(*args, **kwargs)
class openforms.registrations.base.Options
class openforms.registrations.base.PreRegistrationResult(reference: str = '', data: dict | None = None)

Encapsulate the submission reference and any intermediate result from pre-registration.

Registration failure

If the registration fails for whatever reason, then your plugin should raise openforms.registrations.exceptions.RegistrationFailed. This will mark the submission with a failed state, making it possible to handle these failures.

The submission handler extracts the traceback, so you should ideally raise this exception from the root exception to include the full traceback:

try:
    ...  # do plugin stuff
except Exception as exc:
    raise RegistrationFailed from exc