> For the complete documentation index, see [llms.txt](https://doc.orbeon.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.orbeon.com/form-runner/advanced/buttons-and-processes/actions-form-runner/actions-form-runner-save.md).

# save action

## Introduction

This action saves data and attachments via the persistence layer.

## Behavior

The `save` actions performs the following, in order:

* dispatch `fr-data-save-prepare` to `fr-form-model`
* save attachments
* save XML
* dispatch `fr-data-save-done` to `fr-form-model`
* switch to `edit` mode
  * \[UNTIL Orbeon Forms 2016.3] This is part of the `save` action.
  * \[SINCE Orbeon Forms 2017.1] This is done using the separate `new-to-edit` action.

## Parameters

* `draft`: "true" if must be saved as a draft \[SINCE Orbeon Forms 4.4]
* `query`: additional query parameters to pass the persistence layer (is an XPath value template) \[SINCE Orbeon Forms 4.6.1]
* `prune-metadata`:
  * \[SINCE Orbeon Forms 2017.2]
  * "true" if any `fr:*` metadata must be pruned before saving
  * the default is "false"
  * this must be used with care

## Examples

Example of use of the `query` parameter:

```xml
<property as="xs:string"  name="oxf.fr.detail.process.save-final.*.*">
    require-uploads
    then validate-all
    then save(query = "foo=bar&amp;title={//title}")
    then success-message("save-success")
    recover error-message("database-error")
</property>
```

The full URL, for attachments as well as for the XML data, is composed of:

* the URL pointing to the persistence layer path, including the file name
* the following URL parameter
  * `valid`: whether the data sent satisfies validation rules

*NOTE: The `save` action doesn't check data validity before running.*

Example:

```
https://example.org/orbeon/fr/service/persistence/crud/
    orbeon/
    bookshelf/
    data/891ce63e59c17348f6fda273afe28c2b/data.xml?
    valid=true
    
```

## See also

* [Form Runner actions](/form-runner/advanced/buttons-and-processes/actions-form-runner.md)
* [Form Runner send action](/form-runner/advanced/buttons-and-processes/actions-form-runner/actions-form-runner-send.md)
* [Form Runner email action](/form-runner/advanced/buttons-and-processes/actions-form-runner/actions-form-runner-email.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://doc.orbeon.com/form-runner/advanced/buttons-and-processes/actions-form-runner/actions-form-runner-save.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
