Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

After changing buy-from vendor in a purchase quote, set the tax liable = true (default is false)

Posted on by 130

Hi all,

We use purchase quotes for taxable purchases. In this case, most of the vendors in our system are non-taxable for purchase orders.

I would like to:

  • set a trigger after changing the buy-from vendor name 
  • this trigger should over-ride default vendor settings, and set purchaseheader.taxliable = true if it is a purchase quote

Appreciate your guidance and suggestions,

**RESOLVED** Incase if it is of help to anyone

codeunit 60002 c60002PurchaseHeaderTaxLiable
{
    [EventSubscriber(ObjectType::Page, Page::"Purchase Quote", 'OnAfterValidateEvent', 'Buy-from Vendor Name', false, false)]
    local procedure MyProcedure(var Rec: Record "Purchase Header")
    begin
        Rec."Tax Liable" := true;
        Rec."Tax Area Code" := 'CA';
        rec.Modify();
    end;
}

Thank you

  • SammySevens Profile Picture
    SammySevens 130 on at
    RE: After changing buy-from vendor in a purchase quote, set the tax liable = true (default is false)

    Another winner from Mohana, thank you again!!

  • Verified answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: After changing buy-from vendor in a purchase quote, set the tax liable = true (default is false)

    You can try the below code.

    [EventSubscriber(ObjectType::Table, Database::"Purchase Header", 'OnAfterCopyBuyFromVendorFieldsFromVendor', '', false, false)]

       local procedure OnAfterCopyBuyFromVendorFieldsFromVendor(var PurchaseHeader: Record "Purchase Header"; Vendor: Record Vendor; xPurchaseHeader: Record "Purchase Header");

       begin

           if PurchaseHeader."Document Type" = PurchaseHeader."Document Type"::Quote then

               PurchaseHeader."Tax Liable" := true;

       end;

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans