Orbeon Forms
  • Getting started
  • Installation
    • Logging
    • Configuration banner
    • Docker
    • Azure
    • Tomcat
    • WildFly
    • WebSphere
    • WebLogic
    • GlassFish
    • Caches
    • Replication
    • Upgrading
  • Configuration
    • Properties
      • General
        • HTTP client
      • Form Runner
        • Detail page
          • Attachments
          • Email properties
          • PDF
          • Table of contents
        • Persistence
        • Summary page
      • Form Builder
      • XForms
    • Advanced
      • Workflows
      • Session management
      • State handling
      • Client-side error handling
      • Clustering and High Availability
      • Configuring a Form Runner eXist database
      • Creating a production WAR
      • Environments
      • JavaScript and CSS assets
      • Limiter filter
      • Run modes
      • Security
        • Content-Security-Policy header
      • SAP Hybris Module
      • XForms logging
    • Troubleshooting
      • Troubleshooting with the orbeon.log
      • Memory and threads
      • Relational database logging
      • Misc
  • Form Builder
    • Form settings
      • Time window
    • Form editor
      • Form area
      • Toolbox
      • Buttons bar
      • Control settings
      • Dependent fields and sections
      • Validation
      • Choices editor
      • Publishing
      • Cut, copy and paste
      • Section and grid settings
      • Section settings
      • Grid settings
      • Quick control search
      • Repeat settings
      • Repeated grids
      • Undo and redo
      • Keyboard shortcuts
    • Formulas
      • Examples of formulas
      • Formulas inspector
      • Formulas console
    • Summary page
    • Form localization
    • Advanced
      • Edit source
      • Services and actions
        • HTTP services
        • Database services
        • Simple Actions
        • Action Syntax
        • Action Syntax examples
        • Synchronizing repeated content
      • Testing a form in web mode
      • Testing PDF production
      • Testing offline functionality
      • Email Settings dialog
      • Field-level encryption
      • Messages
      • Section templates
      • Template syntax
      • XML Schemas support
      • Extensibility
        • Extension API
        • Integration
        • Toolbox component metadata
  • Form Runner
    • Overview
      • Terminology
    • Pages
      • Landing page
      • Published Forms page
      • Forms Admin page
      • Summary page
    • Components
      • Alert dialog
      • Attachment
      • Autocomplete
      • Captcha
      • Character counter
      • Checkbox input
      • Currency
      • Date
      • Dropdown date
      • Static and dynamic dropdown
      • Error summary
      • Grid
      • Handwritten signature
      • Hidden field
      • Image
      • Image annotation
      • Image attachment
      • Number
      • Open selection
      • Repeater
      • Formatted Text / Rich Text Editor
      • Section
      • Single-selection tree
      • Source code editor
      • Time
      • US phone
      • US state
      • Video
      • Video attachment
      • Wizard
      • XForms inspector
      • Yes/No answer
    • Features
      • Automatic calculations dependencies
      • Datasets
      • Excel and XML import
      • Excel and XML export
      • Summary page Excel Export
      • Form definitions and form data Zip Export
      • Purging historical data
      • Lease
      • Localization
      • Supported languages
      • Mobile support
      • Multitenancy
      • Form Runner navigation bar
      • PDF production
        • Automatic PDF
        • Automatic PDF header and footer configuration
        • PDF templates
      • Responsive design
      • Revision history
      • S3 storage
      • Simple data migration
      • TIFF production
      • Versioning
      • Wizard view
      • Workflow stage
    • Persistence
      • Using a relational database
      • Relational database schema
      • Purging old data using SQL
      • Auditing
      • Autosave
      • Database support
      • Flat view
    • Linking and embedding
      • Linking
      • Java Embedding API
      • JavaScript Embedding API
      • Liferay full portlet
      • Liferay proxy portlet
      • Securing Form Runner access
      • Form Runner offline embedding API
      • Angular component
      • React component
    • Access control and permissions
      • Users
      • Login & Logout
      • Deployed forms
      • Form fields
      • Editing forms
      • Owner and group member
      • Organizations
      • Scenarios
      • Token-based permissions
    • Styling
      • CSS
      • Grids CSS
      • Automatic PDF styling and CSS
    • APIs
      • Authentication of server-side service APIs
      • Persistence API
        • CRUD API
        • Search API
        • List form data attachments API
        • Form Metadata API
        • Lease API
        • Reindexing API
        • Caching
        • Versioning
        • Revision History API
        • Zip Export API
        • Custom persistence providers
      • Other APIs
        • Connection context API
        • Duplicate form data API
        • File scan API
        • Form Runner JavaScript API
        • Generate XML Schema API
        • PDF API
        • Publish form definition API
        • Run form in the background API
      • Data formats
        • Form data
        • Date and time
        • Form definition
    • Architecture and integration
      • Architecture
      • Access form data
      • Integration
    • Advanced
      • Buttons and processes
        • Simple process syntax
        • Core actions
        • Form Runner actions
          • Save action
          • Send action
          • Email action
        • XForms actions
        • Predefined buttons, processes and dialogs
        • Summary page buttons and processes
      • Custom dialogs/model logic
      • Services
      • Singleton form
      • Monitoring HTTP requests
  • XForms
    • Core
      • Attribute Value Templates (AVTs)
      • Binds
      • Validation
      • Variables
      • Keyboard focus
      • XForms JavaScript API
      • Error handling
        • Detailed behavior
      • Model-Bind variables
      • XForms 2.0 support
    • Events
      • Standard support
      • UI refresh events
      • Keyboard events
      • Extension events
      • Extension context information
      • Other event extensions
    • Actions
      • Repeat, insert and delete
      • Scripting actions
      • Extensions
    • Controls
      • Label, hint, help
      • Input
      • Output
      • Text area
      • Button
      • Upload
      • Dialog
    • Submission
      • Standard support
      • JSON support
      • Asynchronous submissions
      • Caching extension
      • Other submission extensions
    • XPath
      • Type annotations
      • Expression analysis
      • Tips
      • Compatibility
      • Standard functions
      • Maps and arrays Functions
      • Extension functions
        • Core functions
        • Utility functions
        • Model functions
        • Controls functions
        • XML functions
        • JSON functions
        • HTTP functions
        • Form Runner functions
        • Other functions
        • Deprecated functions
    • XBL components
      • FAQ
      • Guide
        • XBL Tutorial
        • Bindings
        • XForms models
        • Including content
        • Event handling
        • Conventions
        • Map XBL example
        • Learning from existing components
      • Advanced topics
        • XBL Modes
        • JavaScript companion classes
        • XBL library
        • Extensions
        • Attachment controls
    • XForms tutorial
      • Introduction
      • Installation
      • The Hello application
      • The Bookcast application
        • The basic app
        • Database access
        • Polishing the app
        • Adding a feed
    • Using XForms from Java apps
  • XML Platform
    • Page Flow Controller
      • Basics
      • XML submission
      • Navigating between pages
      • Paths and matchers
      • Other configuration elements
      • Typical combinations of page model and page view
      • Examples
      • Authorizing pages and services
    • Processors
      • URL generator
      • Request generator
      • PDF to image converter
    • Resources
      • Resource managers
      • Setting up an external resources directory
    • Other
      • Binary and text documents
  • FAQ
    • Licensing
    • PE and Dev Support
    • Form Builder and Form Runner
    • Resources and support
    • Other technical questions
  • Contributors
    • Automated tests
    • Building Orbeon Forms
    • Localizing Orbeon Forms
    • Validation functions
    • Contributor License Agreement
  • Release notes
    • Orbeon Forms 2022.1.9
    • Orbeon Forms 2024.1.1
    • Orbeon Forms 2023.1.7
    • Orbeon Forms 2024.1
    • Orbeon Forms 2023.1.6
    • Orbeon Forms 2023.1.5
    • Orbeon Forms 2021.1.11
    • Orbeon Forms 2022.1.8
    • Orbeon Forms 2023.1.4
    • Orbeon Forms 2023.1.3
    • Orbeon Forms 2023.1.2
    • Orbeon Forms 2022.1.7
    • Orbeon Forms 2023.1.1
    • Orbeon Forms 2023.1
    • Orbeon Forms 2022.1.6
    • Orbeon Forms 2021.1.10
    • Orbeon Forms 2022.1.5
    • Orbeon Forms 2021.1.9
    • Orbeon Forms 2022.1.4
    • Orbeon Forms 2022.1.3
    • Orbeon Forms 2021.1.8
    • Orbeon Forms 2022.1.2
    • Orbeon Forms 2022.1.1
    • Orbeon Forms 2022.1
    • Orbeon Forms 2021.1.7
    • Orbeon Forms 2021.1.6
    • Orbeon Forms 2021.1.5
    • Orbeon Forms 2021.1.4
    • Orbeon Forms 2021.1.3
    • Orbeon Forms 2021.1.2
    • Orbeon Forms 2021.1.1
    • Orbeon Forms 2021.1
    • Orbeon Forms 2020.1.6
    • Orbeon Forms 2019.2.4
    • Orbeon Forms 2019.1.2
    • Orbeon Forms 2018.2.5
    • Orbeon Forms 2018.1.4
    • Orbeon Forms 2020.1.5
    • Orbeon Forms 2020.1.4
    • Orbeon Forms 2020.1.3
    • Orbeon Forms 2020.1.2
    • Orbeon Forms 2019.2.3
    • Orbeon Forms 2020.1.1
    • Orbeon Forms 2020.1
    • Orbeon Forms 2019.2.2
    • Orbeon Forms 2019.2.1
    • Orbeon Forms 2019.1.1
    • Orbeon Forms 2019.2
    • Orbeon Forms 2019.1
    • Orbeon Forms 2018.2.4
  • Release history
  • Use cases
  • Product roadmap
  • Index of features
Powered by GitBook
On this page
  • Availability
  • Purpose
  • Usage
  • HTTP request and response
  • Running processes
  • Returning form data
  • Testing whether the form is running in the background
  • Disabling formula evaluation
  • Examples
  • Create initial data
  • Update existing data
  • Validate data
  • Using curl
  • Permissions
  • See also
  1. Form Runner
  2. APIs
  3. Other APIs

Run form in the background API

Availability

Since Orbeon Forms 2017.2.

This is an Orbeon Forms PE feature.

Purpose

The purpose of this service is to run a form definition, either in "new" mode or in "edit" mode, but in the background, optionally running one or more processes in addition to the regular execution of the form.

This allows scenarios such as:

  • create new form data in the database

  • read, modify and update existing form data

Usage

HTTP request and response

  • URLs:

    • /fr/service/$app/$form/new

    • /fr/service/$app/$form/edit/$document

  • Method: POST

Where:

  • $app is the form definition's application name

  • $form is the form definition's form name

  • $document is the form data's document id

Optional request body when using /new:

  • Content-Type: application/xml

When not POSTing any XML data, just POST an empty request body to the service.

By default, the latest published and available form definition version is used. You can request a specific form definition version using the form-version parameter. For example:

  • /fr/service/acme/order/new?form-version=2

  • /fr/service/acme/order/edit/fc4c32532e8d35a2d0b84e2cf076bb070e9c1e8e?form-version=3

Response body:

  • Content-Type: application/xml

  • contains

    • the newly created or existing document id

    • whether all processes were successful

Example response body:

<?xml version="1.0" encoding="UTF-8"?>
<response>
    <document-id>9eff349bfd95aab8d4d5e048bd25a815</document-id>
    <process-success>true</process-success>
</response>

Running processes

The following property controls what process(es) to run:

oxf.fr.detail.process.
  after-controls|after-data|before-data.
  background.
  new|edit.
  $app.
  $form

where $app and $form represent a Form Runner application name and/or form name or * wildcards, as is usual with Form Runner configuration properties.

  • /fr/service/acme/order/edit/fc4c32532e8d35a2d0b84e2cf076bb070e9c1e8e?fr-process-name=custom-process

Returning form data

[SINCE Orbeon Forms 2021.1]

This must first be enabled with the following property:

<property 
    as="xs:boolean"
    name="oxf.fr.detail.service.background.enable-return-data.*.*" 
    value="true"/>

Then, if you pass the URL parameter return-data=true to the service, form data is returned:

<response>
    <document-id>9eff349bfd95aab8d4d5e048bd25a815</document-id>
    <data>
        <form>
            <my-section>
                <my-control>Cat</my-control>
            </my-section>
        </form>
    </data>
    <process-success>true</process-success>
</response>

By default, the data is returned in the 4.0.0 data format. You can override this by passing the data-format-version parameter:

  • data-format-version

    • edge: send the data in the latest internal format

    • 2019.1.0: send the data in the Orbeon Forms 2019.1-compatible format

    • 4.8.0: send the data in the Orbeon Forms 4.8-compatible format

    • 4.0.0: send the data in the Orbeon Forms 4.0-compatible format (the default)

The prune-metadata parameter can be used to control production of metadata:

  • true to remove all occurrences of fr:-prefixed elements and attributes

  • false to leave such occurrences

  • default

    • false when data-format-version is set to edge

    • true otherwise

Testing whether the form is running in the background

[SINCE Orbeon Forms 2021.1]

Disabling formula evaluation

[SINCE Orbeon Forms 2021.1]

The following URL parameters, passed to the service, allow disabling the evaluation of some categories of formulas when the form runs:

  • disable-default=true: disable the evaluation of initial values

  • disable-calculate=true: disable the evaluation of calculated values

  • disable-relevant=true: disable the evaluation of visibility values

Examples

Create initial data

The following example saves new instance data to the database for the form acme/sales when the service is called with /fr/service/acme/sales/new:

<property 
    as="xs:string" 
    name="oxf.fr.detail.process.after-controls.background.new.acme.sales">
    save
</property>

Update existing data

The following example updates existing instance data with the current time for the form acme/sales and saves it to the database when the service is called with /fr/service/acme/sales/edit/$document, where $document represents an existing form data document id:

<property 
    as="xs:string" 
    name="oxf.fr.detail.process.after-controls.background.edit.acme.sales">
    xf:setvalue(ref ="//current-time", value = "current-dateTime()") then save
</property>

Validate data

The following process allows you to POST XML data to the page:

<property as="xs:string" name="oxf.fr.detail.process.after-controls.background.new.*.*">
    validate("error")
</property>

NOTE: Make sure you use validate("error") instead of require-valid, as the latter always returns a success value.

Using curl

  • The new background service: curl -X POST http://localhost:8080/orbeon/fr/service/a/a/new

  • The edit background service: curl -X POST http://localhost:8080/orbeon/fr/service/a/a/edit/123

Permissions

  • Appropriate container or permission headers must also be set to allow accessing the form definition and data.

See also

PreviousPublish form definition APINextData formats

Last updated 3 months ago

XML data to POST to the form, like when

For detail on the process names and more, see .

It is also possible to explicitly specify the process to run via the fr-process-name URL parameter. When specified, the fr-process-name parameter takes precedence over the oxf.fr.detail.process.* properties. Example:

See the function.

The following examples use the command-line utility, on a form a/a (i.e. with app name = a and form name = a), and where relevant document id 123. Along with using the appropriate server name, you'll want to replace those by your actual form name, app name, and document id.

The caller must either call the service internally or have .

[SINCE Orbeon Forms 2024.1]
curl
authorized the service
POSTing to the detail page
Running processes upon page load
Running processes upon page load
fr:is-background()
fr:is-background()