Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Unanswered

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

Posted on by 30
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;
Categories:
  • MA-22070947-0 Profile Picture
    MA-22070947-0 30 on at
    Is there any table trigger/Event Subscriber that run after getting the whole data of row?
    @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
        {
        }
    }
  • Mohana Yadav Profile Picture
    Mohana Yadav 50,454 Super User on at
    Is there any table trigger/Event Subscriber that run after getting the whole data of row?
    What page is it?
    Can you set Delayed Insert property to the page?
  • MA-22070947-0 Profile Picture
    MA-22070947-0 30 on at
    Is there any table trigger/Event Subscriber that run after getting the whole data of row?
    Hi Mohana Yadav,

    I have tried it already but this idea got rejected. :-(
  • MA-22070947-0 Profile Picture
    MA-22070947-0 30 on at
    Is there any table trigger/Event Subscriber that run after getting the whole data of row?
    Hi Gdrenteria,

    can you please show me that how can I set business rules.
     
    Thanks.
  • Mohana Yadav Profile Picture
    Mohana Yadav 50,454 Super User on at
    Is there any table trigger/Event Subscriber that run after getting the whole data of row?
    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.
  • gdrenteria Profile Picture
    gdrenteria 5,038 Super User on at
    Is there any table trigger/Event Subscriber that run after getting the whole data of row?
    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
  • MA-22070947-0 Profile Picture
    MA-22070947-0 30 on at
    Is there any table trigger/Event Subscriber that run after getting the whole data of row?
    By the way i want to get all the data from rec and set on JsonString variable

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,995 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,610 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans