# ​How to Run a Scenario via Integration

You can run a specific scenario via an integration. To do this, set the scenario UUID in the envelope XML in the integration rule.

Integration data has the highest priority. It replaces scenario data if it’s defined in the integration rule.

Set the scenario UUID in the `<envelope>` tag as the `scenarioUuid` attribute:

```markup
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        <envelope templateUuid="19089ab8-a828-4447-9129-44b1da1cbc9d" templateVersion="f2e1a1c5-15ac-4bfb-bf31-f1ddba652b89" scenarioUuid="e17db760-580a-4192-bc96-a91683123bea">
                ...
        </envelope>
    </xsl:template>
</xsl:stylesheet>
```

You can start a scenario from any step via an integration. The system automatically picks the first step that matches the template and version. It creates an envelope using the data from the integration rule.

By default, the scenario chain configuration is ignored for envelopes created via an integration rule. To chain envelopes, set the chain UUID in the `<envelope>` tag as the `chainUuid` attribute.

* Use a static UUID to chain all envelopes created by the integration.
* Use a dynamic UUID to chain envelopes separately per extracted file.

```markup
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        <envelope templateUuid="19089ab8-a828-4447-9129-44b1da1cbc9d" templateVersion="f2e1a1c5-15ac-4bfb-bf31-f1ddba652b89" scenarioUuid="e17db760-580a-4192-bc96-a91683123bea" chainUuid="e17db760-580a-4192-bc96-a91683123ben">
                ...
        </envelope>
    </xsl:template>
</xsl:stylesheet>
```


---

# Agent Instructions: 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:

```
GET https://support.docstudio.com/user/scenarios/running-scenarios/how-to-run-a-scenario-via-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
