> For the complete documentation index, see [llms.txt](https://docs.solutioo.de/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.solutioo.de/entwicklerdokumentationen-business-central-dhl-connector/dhl-connector-entwicklerdokumentation/integration-events.md).

# Integration Events

Der DHL Connector 25.22.0.0 veröffentlicht drei dokumentierte `IntegrationEvent`s. Subscriber werden in der Consumer-App als lokale Procedures implementiert.

## OnBeforeSendShipmentRequest

Publisher: Codeunit `72242952 "SOUDHL API Management"`

```al
[IntegrationEvent(false, false)]
procedure OnBeforeSendShipmentRequest(
    var RequestJson: JsonObject;
    SOUDHLPackageHeaderRecord: Record "SOUDHL Package Header";
    SalesHeader: Record "Sales Header")
```

Das Event wird ausschließlich im **DHL-Express-Prozess** ausgelöst:

* nachdem der MyDHL-Shipment-Request aufgebaut wurde,
* bevor der Request serialisiert und an `/shipments` gesendet wird.

Für Parcel DE existiert in Version 25.22.0.0 kein entsprechendes Request-Event.

### Subscriber-Beispiel

```al
codeunit 50110 "My DHL Event Subscribers"
{
    [EventSubscriber(
        ObjectType::Codeunit,
        Codeunit::"SOUDHL API Management",
        'OnBeforeSendShipmentRequest',
        '', false, false)]
    local procedure OnBeforeSendDhlRequest(
        var RequestJson: JsonObject;
        PackageHeader: Record "SOUDHL Package Header";
        SalesHeader: Record "Sales Header")
    var
        ExpressHelper: Codeunit "SOUDHL Express Helper";
        ProductCode: Code[5];
    begin
        ProductCode := ExpressHelper.MapProductCode(
            Enum::"SOUDHL Express Product"::Express1200);

        if RequestJson.Contains('productCode') then
            RequestJson.Replace('productCode', ProductCode);
    end;
}
```

### Regeln für Request-Subscriber

* Nur dokumentierte MyDHL-Felder verändern.
* Pflichtknoten nicht entfernen und den kompletten Request nicht ersetzen.
* Keine Zugangsdaten, Authentifizierungsheader oder Endpoints verwalten.
* Request-JSON nicht protokollieren; es enthält personenbezogene Versanddaten.
* Keine UI-Dialoge und keine unnötigen `Commit()`-Aufrufe im Subscriber ausführen.
* Ein Fehler im Subscriber bricht die Labelerzeugung ab.
* Anpassungen gegen Sandbox und Live fachlich testen.

Da dieser Hook die Transportstruktur sichtbar macht, gilt seine JSON-Struktur als semi-stabil. Wenn eine Anpassung ohne JSON-Kopplung benötigt wird, sollte ein zusätzlicher fachlicher Event-Hook angefordert werden.

## OnBeforeSetPackageSubpageVisible

Publisher: Codeunit `72242964 "SOUDHL Sales UI"`

```al
[IntegrationEvent(false, false)]
procedure OnBeforeSetPackageSubpageVisible(
    SalesHeader: Record "Sales Header";
    var IsVisible: Boolean)
```

Der Standardwert ist `true`. Eine abhängige App kann die DHL-Paket-Subpage auf dem Verkaufsauftrag ausblenden, wenn sie eine eigene Versandoberfläche bereitstellt.

```al
[EventSubscriber(
    ObjectType::Codeunit,
    Codeunit::"SOUDHL Sales UI",
    'OnBeforeSetPackageSubpageVisible',
    '', false, false)]
local procedure HideDhlPackageSubpage(
    SalesHeader: Record "Sales Header";
    var IsVisible: Boolean)
begin
    IsVisible := false;
end;
```

Produktiv sollte die Zuweisung nur erfolgen, wenn eine eigene Setup-Option die alternative Versandoberfläche aktiviert.

## OnBeforeSetListActionsVisible

Publisher: Codeunit `72242964 "SOUDHL Sales UI"`

```al
[IntegrationEvent(false, false)]
procedure OnBeforeSetListActionsVisible(var IsVisible: Boolean)
```

Der Standardwert ist `true`. Das Event steuert die DHL-Aktionsgruppen auf Listen und gebuchten Verkaufsbelegen.

```al
[EventSubscriber(
    ObjectType::Codeunit,
    Codeunit::"SOUDHL Sales UI",
    'OnBeforeSetListActionsVisible',
    '', false, false)]
local procedure HideDhlListActions(var IsVisible: Boolean)
begin
    IsVisible := false;
end;
```

Auch dieses Ausblenden sollte produktiv von einer eigenen Setup-Option abhängen.

## Noch nicht vorhandene Events

Version 25.22.0.0 besitzt derzeit keine allgemeinen Events für:

* `OnBeforeGenerateLabel`
* `OnAfterGenerateLabel`
* `OnLabelGenerationFailed`
* Parcel-DE-Request-Anpassungen
* Paket-Erzeugung vor oder nach dem Packing
* Live-Rate-Aufrufe vor oder nach dem Versand

Wenn ein solcher Hook benötigt wird, sollte er mit einem konkreten fachlichen Anwendungsfall bei Solutioo angefragt werden. Von einem Umgehen über Low-Level-Methoden wird abgeraten.


---

# 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://docs.solutioo.de/entwicklerdokumentationen-business-central-dhl-connector/dhl-connector-entwicklerdokumentation/integration-events.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.
