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...
Unanswered

Is there any table trigger/Event Subscriber that run after getting the whole data of row?

(1) ShareShare
ReportReport
Posted on by 85
Here I'm using the OnAfterInsertEvent trigger which always fires after even getting the single data from row and send it to my methods which resulted in getting the error all the time. I want to use some other trigger or thing that can only be fired when all data of row has been inserted or you can say when user complete it's insertion on working row.
 
 

    [EventSubscriber(ObjectType::Table, Database::"Arm_Vendor Insurance", 'OnAfterInsertEvent', '', true, true)]
    local procedure VendorInsuranceInsertCheck(var Rec: Record "Arm_Vendor Insurance"; RunTrigger: Boolean)
    var
        JsonString: Text;
        ApiMgtCodeunit: Codeunit ApiMgt_Codeunit;
        Vendor: Record Vendor;
        IntInsuranceReq: Integer;
    begin
        Vendor.SetRange(Vendor."No.", Rec."Vendor No.");
        if Vendor.FindFirst() and Vendor."Link With BuilderMT" then begin
            JsonString := '{"subNavNumber":"' + Rec."Vendor No." + '","lineNo":' + Format(Rec."Line No.") + ',"insuranceTypeCode":"AUTO","insuranceRequired":0,"policyNumber":"' + Rec."Policy Number" + '","policyStartDate":"' + Format(Rec."Policy Start Date") + '","policyExpirationDate":"' + Format(Rec."Policy Expiration Date") + '","insuranceCompanyName":"' + rec."Insurance Company Name" + '","insuranceContactName":"' + rec."Insurance Contact Name" + '","insuranceContactPhoneNo":"' + rec."Insurance Contact Phone No." + '","coverageamount":' + Format(rec."Coverage Amount") + ',"createddatetime":"","createdby":"{00000000-0000-","updateddatetime":"","updatedby":"{00000000-0000-","isActive":true}';
            ApiMgtCodeunit.GetInsuranceDetails(JsonString);
    end;
    end;
I have the same question (0)
  • MA-22070947-0 Profile Picture
    85 on at
    By the way i want to get all the data from rec and set on JsonString variable
  • Gerardo Rentería García Profile Picture
    25,213 Most Valuable Professional on at
    Hi
    In this case you should set your business rules.
    That is, what fields should be completed for you to consider the record truly inserted?
    In this event, or in the modification event, you should analyze these fields and their values.
    BR
    GR
  • Mohana Yadav Profile Picture
    60,993 Super User 2025 Season 2 on at
    You can include a boolean/status field and ask the user to make it to true/released after entering all the data.
    You can use that field in your code at the beginning.
  • MA-22070947-0 Profile Picture
    85 on at
    Hi Gdrenteria,

    can you please show me that how can I set business rules.
     
    Thanks.
  • MA-22070947-0 Profile Picture
    85 on at
    Hi Mohana Yadav,

    I have tried it already but this idea got rejected. :-(
  • Mohana Yadav Profile Picture
    60,993 Super User 2025 Season 2 on at
    What page is it?
    Can you set Delayed Insert property to the page?
  • MA-22070947-0 Profile Picture
    85 on at
    @Mohana

    Here is my custom Page. But I got this page by Dependencies.

    page 50006 "Arm_Vendor Insurance"
    {
        AutoSplitKey = true;
        Caption = 'Vendor Insurance';
        DataCaptionFields = "Vendor No.";
        LinksAllowed = false;
        PageType = List;
        UsageCategory = Lists;
        SourceTable = "Arm_Vendor Insurance";
        ApplicationArea = all;
        layout
        {
            area(content)
            {
                repeater(Group)
                {
                    Caption = 'Group';
                    field("Insurance Type"; Rec."Insurance Type")
                    {
                        ApplicationArea = all;
                    }
                    field("Insurance Required"; Rec."Insurance Required")
                    {
                        ApplicationArea = all;
                    }
                    field("Policy Number"; Rec."Policy Number")
                    {
                        ApplicationArea = all;
                    }
                    field("Policy Start Date"; Rec."Policy Start Date")
                    {
                        ApplicationArea = all;
                    }
                    field("Policy Expiration Date"; Rec."Policy Expiration Date")
                    {
                        ApplicationArea = all;
                    }
                    field("Insurance Company Name"; Rec."Insurance Company Name")
                    {
                        ApplicationArea = all;
                    }
                    field("Insurance Contact Name"; Rec."Insurance Contact Name")
                    {
                        ApplicationArea = all;
                    }
                    field("Insurance Contact Phone No."; Rec."Insurance Contact Phone No.")
                    {
                        ApplicationArea = all;
                    }
                    field("Coverage Amount"; Rec."Coverage Amount")
                    {
                        ApplicationArea = all;
                    }
                    field(Description; Rec.Description)
                    {
                        ApplicationArea = all;
                        Visible = false;
                    }
                }
            }
        }
        actions
        {
        }
    }

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,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans