> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flowforma.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Document Action Rule

> Use the Document Action Rule to check in, check out, rename, delete, or recycle a SharePoint document from a FlowForma flow and capture its ID.

The Document Action Rule performs an action on a document stored in a SharePoint library (such as checking it in or out, renaming, deleting, or recycling it) and optionally captures the document's ID into a question.

## Title

The first part of the business rule lets you define a **title** for your rule and select the event on which it operates. The default title is the standard **FlowForma** rule name; change it by deleting the text and entering your own.

In the **event** field you determine when the rule is executed. For a flow this can occur when the form is loaded, started, or completed. For a step this can occur when the step is started, saved, or completed. For questions it can occur when the question is updated.

## Rule condition(s)

The second part of the business rule lets you set conditions. These are not required, but if entered they control when the rule is executed in relation to other items in the form.

## Rule actions

* **Document URL**: click Editor to open the document picker. Three selection modes are available:
  * **Question**: select a document upload, single line of text, or calculated question (including sub-questions of these types inside a repeating table). The rule resolves the document URL from that question's value at runtime.
  * **Rule**: select a Generate Document or Merge PDF rule. The document path is derived automatically from that rule's output definition.
  * **Static path**: select a step (folder) in the tree, then type a filename in the File Name field. The rule builds a fixed path in the form /FormDocuments/{FormTitle}/{StepTitle}/{filename}. Use this when the document lives at a known, predictable location. The File Name field is disabled when a question or rule is selected.
  * You can use text tokens ({FormID}, {StepID}, {FlowTitle}, {StepTitle}, {FormTitle}) to change the path each time the rule runs.
* **Document Action**: select the action to perform on the document. Available options are:
  * **None**: no action is taken on the document.
  * **Check Out**: checks out the document via the SharePoint Client Context.
  * **Check In**: checks in the document via the SharePoint Client Context.
  * **Rename**: renames the document. Requires selecting a Get Document Name question (see below).
  * **Delete**: permanently deletes the document via the FlowForma server.
  * **Recycle**: moves the document to the SharePoint recycle bin via the FlowForma server.
* **Get Document Name** (Rename only): select the question whose value will be used as the new document name at runtime.
* **Get Document ID**: enable this option to capture the SharePoint list item ID of the document after the action completes, then select the target question where the ID should be stored. Available for all action types.
* **Source Document Properties** (Microsoft 365 only): when the document URL is sourced from a document upload question, the following properties can be extracted into other questions after the action runs:
  * **Source document folder**: captures the folder path of the source document.
  * **Source document URL**: captures the full URL of the source document.
  * **Source document name**: captures the filename of the source document.
  * **Source document ID**: captures the SharePoint list item ID of the source document.

<Info>This rule is not compatible with Multiple File Upload questions.</Info>

* **Stop execution**: if stop execution is enabled and this rule is executed, no other rules are executed.
* **Enabled**: rules aren't saved to a list like questions and steps are, so if you want to stop a rule executing without deleting it, toggle this option to enable or disable the rule.
* **Enable audit**: if checked, a record is added to the audit trail when this rule is executed. This option is available when the Compliance feature pack is activated.
