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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

Trigger a flow when a field is modified – Business events

(1) ShareShare
ReportReport
Posted on by

Hi Everyone,
I am trying to trigger the power automate flow when the customer price group and country field modifies in Business central, First few days Everything was doing fine but later on I face that whenever I Try to mark a sales order from open to release it shows the following error.

And when I post the sales order it shows this error
 

 
enumextension 50100 EventCategoryExt extends EventCategory
{
    value(0; "Sales")
    {
    }
}


 

codeunit 50101 BusinessEventHandler
{
    [ExternalBusinessEvent('custpricegrouporcountrychanged',
        'Customer Price Group or Country changed',
        'Triggered when Customer Price Group or Country/Region Code is updated',
        EventCategory::"Sales")]
    procedure CustomerPriceGroupOrCountryChanged(customerId: Guid)
    begin
    end;


 

    [ExternalBusinessEvent('contactcountrychanged',
        'Contact Country changed',
        'Triggered when Country/Region Code is updated on a Contact',
        EventCategory::"Sales")]
    procedure ContactCountryChanged(contactId: Guid)
    begin
    end;


 

    [EventSubscriber(ObjectType::Table, Database::Customer,
        OnAfterValidateEvent, "Customer Price Group", false, false)]
    local procedure OnValidateCustomerPriceGroup(var Rec: Record Customer)
    begin
        CustomerPriceGroupOrCountryChanged(Rec.SystemId);
    end;


 

    [EventSubscriber(ObjectType::Table, Database::Customer,
        OnAfterValidateEvent, "Country/Region Code", false, false)]
    local procedure OnValidateCountryRegionCode(var Rec: Record Customer)
    begin
        CustomerPriceGroupOrCountryChanged(Rec.SystemId);
    end;


 

    [EventSubscriber(ObjectType::Table, Database::Contact,
        OnAfterValidateEvent, "Country/Region Code", false, false)]
    local procedure OnValidateContactCountryRegionCode(var Rec: Record Contact)
    begin
        ContactCountryChanged(Rec.SystemId);
    end;
}




Thanks.

 

I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    102,649 Super User 2026 Season 1 on at

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 619 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 498 Super User 2026 Season 1

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 243 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans