> For the complete documentation index, see [llms.txt](https://docs.locoia.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.locoia.com/connectors/building-connectors/building-connector-actions/actions-examples.md).

# Actions Examples

Examples of best practice created actions

### **Invoicing**

#### Line Items

**1. LexOffice > Create Vouchers**

UI form schema:

{% code lineNumbers="true" %}

```json
{
  "type": {
    "type": "select",
    "title": "Type",
    "enum": [
      "salesinvoice",
      "salescreditnote",
      "purchaseinvoice",
      "purchasecreditnote",
      "invoice",
      "downpaymentinvoice",
      "creditnote",
      "orderconfirmation",
      "quotation",
      "deliverynote"
    ],
    "info": "Possible values are salesinvoice (e.g. for sales orders), and salescreditnote (e.g. for refunds or returned sales orders).",
    "required": true
  },
  "voucherNumber": {
    "type": "text",
    "title": "Voucher number",
    "placeholder": "2345678",
    "required": true
  },
  "voucherDate": {
    "type": "date",
    "placeholder": "2016-06-29T15:15:09.447+02:00",
    "title": "Voucher date",
    "required": true
  },
  "shippingDate": {
    "type": "date",
    "placeholder": "2016-06-29T15:15:09.447+02:00",
    "title": "Shipping date",
    "required": false
  },
  "dueDate": {
    "type": "date",
    "placeholder": "2016-06-29T15:15:09.447+02:00",
    "info": "If not specified then the voucherDate will also be used for dueDate.",
    "title": "Due date",
    "required": false
  },
  "totalGrossAmount": {
    "type": "text",
    "placeholder": "119.00",
    "title": "Total gross amount",
    "required": true
  },
  "totalTaxAmount": {
    "type": "text",
    "placeholder": "19",
    "title": "Total tax amount",
    "required": true
  },
  "taxType": {
    "type": "select",
    "enum": [
      "net",
      "gross"
    ],
    "default": "gross",
    "allowCreate": true,
    "title": "Tax type",
    "required": true
  },
  "useCollectiveContact": {
    "type": "switch",
    "default": true,
    "title": "Use collective contact",
    "info": "Set to true if the Collective Contact (customer/vendor) within lexoffice should be used. If used, the optional contactId will be ignored.",
    "required": false
  },
  "remark": {
    "type": "text",
    "title": "Subject remarks",
    "placeholder": "AWS invoice",
    "required": true
  },
  "voucherItems": {
    "type": "code",
    "mode": "jinja2",
    "rows": "9",
    "title": "Voucher items (Jinja code field)",
    "placeholder": "{% for item in line_items %}\n  {\n    \"amount\": {{ item.amount }},\n    \"taxAmount\": {{ item.taxAmount }},\n    \"taxRatePercent\": {{ item.taxRatePercent }},\n    \"categoryId\": \"8f8664a8-fd86-11e1-a21f-0800200c9a66\" {# this id is Warenverkäufe as per https://developers.lexoffice.io/docs/#vouchers-endpoint-list-of-categoryids #}\n  }\n  {% if not loop.last %},{% endif %}\n{% endfor %}",
    "default": "{% for item in line_items %}\n  {\n    \"amount\": {{ item.amount }},\n    \"taxAmount\": {{ item.taxAmount }},\n    \"taxRatePercent\": {{ item.taxRatePercent }},\n    \"categoryId\": \"8f8664a8-fd86-11e1-a21f-0800200c9a66\" {# this id is Warenverkäufe as per https://developers.lexoffice.io/docs/#vouchers-endpoint-list-of-categoryids #}\n  }\n  {% if not loop.last %},{% endif %}\n{% endfor %}",
    "info": "Use this field if you want to define your line items flexibly (multiple). Here is the docs: https://developers.lexoffice.io/docs/#vouchers-endpoint-create-a-voucher",
    "required": false
  }
}
```

{% endcode %}

Request **body** of the action:

{% code lineNumbers="true" %}

```python
{
  "type": "{{ type }}",
  "voucherNumber": "{{ voucherNumber }}",
  "voucherDate": "{{ voucherDate }}",
  {% if shippingDate is defined %}
    ,"shippingDate": "{{ shippingDate }}"
  {% endif %}
  {% if dueDate is defined %}
    ,"dueDate": "{{ dueDate }}"
  {% endif %}
  "totalGrossAmount": {{ totalGrossAmount }},
  "totalTaxAmount": {{ totalTaxAmount }},
  "taxType": "{{ taxType }}",
  "useCollectiveContact": {{ useCollectiveContact | lower }},
  "remark": "{{ remark }}",
  "voucherItems": [ {{ voucherItems }} ]
}
```

{% endcode %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.locoia.com/connectors/building-connectors/building-connector-actions/actions-examples.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
