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 Power automate flow when a field is modified in Business central

(0) ShareShare
ReportReport
Posted on by 24

Hi Everyone,

I am trying to trigger the power automate flow on change of customer price group and country field in customer table, Everything was working fine initially but now I see a problem that  Whenever I try to release the sales order it shows the following error:

And when I try to post the sales order it show this error:

If requesting support, please provide the following details to help troubleshooting:

Error message: 
An error occurred while applying changes from the object of type 'EnumExtension' with ID '50100' in the 'abc by default publisher 1.0.0.1' app to the application object of type 'Enum' with the ID '2000000001'. Failing delta: Type: 'EnumValueAddDelta'; TargetKind: 'Other'; OrdinalValue: '0'; The error was: NavErrorException - Metadata delta application failed due to the following error(s):

Internal session ID: 
386c76cc-cfff-4475-bbd2-045aaaf8cb66

Application Insights session ID: 
f4021806-a05e-48b4-8d41-9bec2d25d158

Client activity id: 
eda2518a-5c84-4128-bbe8-1d66a7eeb4ce

Time stamp on error: 
2026-07-29T06:19:31.0617912Z

User telemetry id: 
a610a531-7a97-4e58-bd85-8f15cdadf279

AL call stack: 
ErrorMessagesRecommendationExt(PageExtension 7900)."Description - OnDrillDown"(Trigger) line 10 - Error Messages with Recommendations by Microsoft version 27.4.45366.45675

Custom dimensions: 
[{"Item1":"ErrorCallStack","Item2":"\"Release Sales Document\"(CodeUnit 414).OnAfterReleaseSalesDoc(Event) line 2 - Base Application by Microsoft version 27.4.45366.51998\\\"Release Sales Document\"(CodeUnit 414).Code line 95 - Base Application by Microsoft version 27.4.45366.51998\\\"Release Sales Document\"(CodeUnit 414).ReleaseSalesHeader line 5 - Base Application by Microsoft version 27.4.45366.51998\\\"Sales-Post\"(CodeUnit 80).ReleaseSalesDocument line 18 - Base Application by Microsoft version 27.4.45366.51998\\\"Sales-Post\"(CodeUnit 80).CheckAndUpdate line 48 - Base Application by Microsoft version 27.4.45366.51998\\\"Sales-Post\"(CodeUnit 80).RunWithCheck line 58 - Base Application by Microsoft version 27.4.45366.51998\\\"Sales-Post\"(CodeUnit 80).OnRun(Trigger) line 2 - Base Application by Microsoft version 27.4.45366.51998\\\"Sales-Post (Yes/No)\"(CodeUnit 81).RunSalesPost line 12 - Base Application by Microsoft version 27.4.45366.51998\\\"Sales-Post (Yes/No)\"(CodeUnit 81).Code line 28 - Base Application by Microsoft version 27.4.45366.51998\\\"Sales-Post (Yes/No)\"(CodeUnit 81).OnRun(Trigger) line 10 - Base Application by Microsoft version 27.4.45366.51998\\\"Sales Header\"(Table 36).SendToPosting line 18 - Base Application by Microsoft version 27.4.45366.51998\\\"Sales Invoice\"(Page 43).PostDocument line 15 - Base Application by Microsoft version 27.4.45366.51998\\\"Sales Invoice\"(Page 43).\"Post - OnAction\"(Trigger) line 2 - Base Application by Microsoft version 27.4.45366.51998\\"},{"Item1":"CreatedOn","Item2":"29/07/26 11:49"}]


Here is the code

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;
}

 

I have the same question (2)
  • Suggested answer
    Yash_Mistry Profile Picture
    539 on at
    Hello,

    I’m not sure about the exact cause, but it might be because you're using enum value ID 0, which may already be occupied or reserved. Could you try using a different value ID? Also, please verify whether the EventCategory enum has already been extended elsewhere with the same value or ID.
     
    Hope this helps resolve your issue.
    If this solution was helpful, please consider marking it as Verified Answer.
     

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