--- title: "Create a Code event / NETCode event" slug: "bc-create-a-code-event-netcode-event" description: "Learn how to set up Code Events in Microsoft Dynamics 365 Business Central to trigger Business Integration Solutions connections for efficient record processing." tags: ["BC", "BIS", "Business Central", "Business Integration Solutions", "Task"] updated: 2026-06-25T09:59:07Z published: 2026-06-25T09:59:07Z canonical: "docs.staedean.com/bc-create-a-code-event-netcode-event" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.staedean.com/llms.txt > Use this file to discover all available pages before exploring further. # Create a Code event / NETCode event A Code Event triggers from a Dynamics Microsoft Dynamics 365 Business Central object and starts a pipeline for one or more records. ## Usage Use this task when you want to start a Business Integration Solutions connection for a certain record from a specific object. > [!NOTE] > **Note** > > The **Code** event executes synchronously unless you enable **Post with Job Queue**. Use the job queue for processing Business Integration Solutions connections, it offloads processing to a new background session. ## Differences between Code event and NETCode event The Code Event is rewritten to support similar functionality while handling the loss of metadata access during a call. In the NETCode Event version of Business Integration Solutions, the setup bound to a specific object, which was easy to access because the calling object type and ID were available. This metadata is no longer available in the new Code Event. The advantage is that the Code Event has more flexibility. By using a unique ID, you can have several triggers in one object, each potentially triggering different connections at various stages in your code. ## Prerequisites The following prerequisites are required: - Experience developing in Microsoft Dynamics 365 Business Central AL. - Familiarity with event-based programming. - Understanding of Business Integration Solutions and the role of events in the pipeline. - A valid developer license. - An environment with STAEDEAN-Common and Business Integration Solutions-Business Integration Solutions installed. ## Steps for setting up a Code event 1. Open your app in VS Code. 2. Open the object where you want to trigger the code event from. 3. Create a dependency on Business Integration Solutions-Business Integration Solutions: ```plaintext    "dependencies":  [        {            "id": "9b0fdadc-3c4a-4dc4-82bf-6ac1c4bd5d71",            "name": "BIS-Business Integration Solutions",            "publisher": "STAEDEAN",            "version": "20.0.0.0"        }    ], ``` 4. Declare the following local variables: | Name | Datatype | Subtype | | --- | --- | --- | | BISCodeEventAPI | codeunit | "BISAPI Code Event" | | MyRecordRef | RecordRef | | 1. Add one of the following events in your code to trigger the connection: For a single record: ```plaintext RaiseEventForRecord(EventId: Code[50]; RecRef: RecordRef) ``` For a RecordID (as an alternative to RecordReference): ```plaintext RaiseEventForRecord(EventId: Code[50]; "RecordId": RecordId) ``` For a record set: ```plaintext RaiseEventForRecordSet(EventId: Code[50]; RecRef: RecordRef) ``` For a record set with separate messages per record: ```plaintext RaiseEvent(EventId: Code[50]; RecRef: RecordRef) ``` ## Steps for setting up a NETCode event 1. Open your app in VS Code. 2. Open the object where you want to trigger the code event from. 3. Create a dependency on Business Integration Solutions-Business Integration Solutions: ```plaintext    "dependencies":  [        {            "id": "9b0fdadc-3c4a-4dc4-82bf-6ac1c4bd5d71",            "name": "BIS-Business Integration Solutions",            "publisher": "STAEDEAN",            "version": "20.0.0.0"        }    ], ``` 4. Declare the following local variables: | Name | Datatype | Subtype | | --- | --- | --- | | BISCodeEventAPI | codeunit | "BISAPI Code Event" | | MyRecordRef | RecordRef | | 1. Add one of the following events in your code to trigger the connection: ```plaintext RegisterEventForRecord(RecRef: RecordRef) ``` ```plaintext RegisterEvent(RecRef: RecordRef) ``` ```plaintext RegisterEventForRecordSet(SenderObjectType: Text; SenderObjectId: Integer; RecRef: RecordRef) ``` ## Related - [Code event](/bc-code-event.md) - [Code event](/bc-code-event-devkit.md)