web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Table Trigger on Reservation Entries Does not execute

(0) ShareShare
ReportReport
Posted on by

Hello,

I am trying to put a trigger on the "Reservation Entry" table (337) in order to keep track of sales lines and serials within an external dashboard.

On insert, modify, and delete I am trying to send a http request with the serial and sales line info from the reservation entry. My issue is that when i go to test wether the trigger fires nothing happens.

my test is as follows: 

1. Create Sales Order

2. Add item to sales line 

3. Add serial within Item Tracking Lines

4. check logs to see if trigger successfully sent data.

Below is a screenshot of what i am trying to test.

Screen-Shot-2022_2D00_07_2D00_26-at-10.37.15-AM.png

As of now i am not sending anything specific, just the record systemId to verify the request works.

I am confident my payload/request works fine since i copied it from previous working triggers. The only difference is the payload data which is passed into the function responsible for making the request. I have attached my code below. 

tableextension 50174 "Reservation Entry Extension" extends 337
{
    fields
    {
        // TODO
    }


    trigger OnAfterInsert()
    begin
        // I beleive this trigger is not firing for some reason
        HandleTrigger(triggerEnum::insert);
    end;

    trigger OnAfterModify()
    begin
    // I beleive this trigger is not firing for some reason
        HandleTrigger(triggerEnum::modify);
    end;

    trigger OnAfterDelete()
    begin
    // I beleive this trigger is not firing for some reason
        HandleTrigger(triggerEnum::delete);
    end;

    local procedure HandleTrigger(triggerName: Enum TriggerEnum)
    var
        sl: Record "Sales Line";
        data: JsonObject;
    begin
        // These fields should be available at this point
        data.Add('id', JsonTools.sanatizeId(rec.SystemId));
        data.Add('serial', rec."Serial No.");
        // Function responsible for making request, this is used in other triggers and 
        // works perfectly fine, I doubt this is the issue
        buildPayload.HandleTrigger(env.IsProduction(), rec.CurrentCompany(), 'Sales Line', data, triggerName)
    end;

    var
        makeRequest: Codeunit MakeRequest;
        vcuTI: Codeunit "Tenant Information";
        buildPayload: Codeunit "Build Payload Codeunit";
        env: Codeunit "Environment Information";
        JsonTools: Codeunit "Json Tools";
        triggerEnum: Enum TriggerEnum;
}

I have the same question (0)
  • Stefan Sosic Profile Picture
    35 on at

    When do you expect to trigger those events?

    Item Tracking Lines is temporary and reservations are created once page is closed, so maybe your timing is wrong.

    Anyway, a bit cleaner approach would be with event subscriber.

       [EventSubscriber(ObjectType::Table, Database::"Reservation Entry", 'OnAfterInsertEvent', '', true, true)]

       local procedure ReservationEntry_OnAfterInsertEvent()

       begin

       end;

    Don't forget to help the community by verifying the answer or at least like the suggestion if it did help in any way. It will let others know that the topic has verified answer and was beneficial to you.

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,105 Moderator on at

    There can possible be a lot of changes in the reservation entry tables. So another approach you be to have a job queue job that ran on intervals that sends the needed data to your portal.

    Having exports happening in tables based triggers can possible give a performance penalty.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,226

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,047 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,257 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans