# how to generate documents when platform events are fired

{% stepper %}
{% step %}
**Create Custom Platform Event**

* Setup → Platform Events → New Platform Events
* Fill out required fields, save
* Add Custom Field(s)
  * For example, add one for the base record ID
    {% endstep %}

{% step %}
**Set up the process to fire Platform Events**

* In Flow, use the Create Records element to do so
  * Custom Platform Events end in the suffix “\_\_e”
* In Apex, insert Platform Events like any custom object
  {% endstep %}

{% step %}
**Set up a Platform-Event Triggered Flow**

* Specify this to run when your Custom Platform Event is fired
* Add Document Generation as an Apex Action in here
  {% endstep %}
  {% endstepper %}


---

# 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://help.sdocs.com/developer-hub/references/software-development-kit-sdk/how-to-generate-documents-when-platform-events-are-fired.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.
