> For the complete documentation index, see [llms.txt](https://brixxbox.gitbook.io/brixxbox-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://brixxbox.gitbook.io/brixxbox-documentation/client-api-reference/functions/createreport.md).

# createReport

### Parameters

1. reportControlId - the id of the reportControl in your app. This can be invisible, if you don't need a preview.
2. createOptions - JSON Object with options
   * print - (bool, default = false) if set to true, this will trigger the print dialog after the report is create.
   * archive - (bool, default = false) if set to true, the report is saved as an attachment to the current record,
   * saveFile - if set. the report will be downloaded with a generic file name (brixxbox-print.pdf), except, if saveFileName is set.#
   * saveFileName - if set. the report will be downloaded with that file name.
   * reportId - (optional) if defined, this will overruled the reportId given for the control in the config editor. This is not the controlId, but the id (name) of the report definition
   * cloudPrinter - (optional) the created report will be send to the cloud printer right after creation.

Like a on a dataRequest, all controls of the current app will bo automatically send as report parameters, plus the recordId of the current record as "id", even if you dont have a control "id" in your app.

### Example Usages

```javascript
   brixxApi.createReport("invoiceReport", {print: true}); //will create the invoiceReport as a pdf and prints it on the client side
```

```javascript
   brixxApi.createReport("invoiceReport", {
      print: true,
      archive: true,
      documentTypeId: 1,
      saveFileName: "myPrint.pdf"
   }); 
   //will create the invoiceReport as a pdf and prints it on the client side, it will also save the pdf as an attachment to the current record.
```

```javascript
   brixxApi.createReport("invoiceReport", {
      print: true,
      reportId: "invoiceReportSimple"
   }); 
   //In this case, we choose a different reportId
```

#### Create a report and send it to a cloud printer

```javascript
   brixxApi.createReport("invoiceReport", {
      cloudPrinter: "HP LaserJet",
   });
```


---

# 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://brixxbox.gitbook.io/brixxbox-documentation/client-api-reference/functions/createreport.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.
