RSS

Tag: 0000G92 – Sales Header must not be temporary

19 Apr

Are you running OnPrem and you get a lot of warnings “Tag: 0000G92 – Sales Header must not be temporary” or “Tag: 0000G95 – Sales Header must not be temporary” in the event viewer like this?

The reason why we get this is that we have code that creates temporary sales headers. In our case we had an “oldschool” price function that gets the price to the web shop by creating a temporary sales order.

The code in question that generates this are the functions UpdateSalesLineAmounts, UpdateSalesLinesByFieldNo in table 36 “Sales Header”.

You don’t get any warnings when you run this code in Business Central but it only shows up in the eventviewer.

Why is that? Well if we lookup the command session.logmessage we can see that if it has TelemetryScope::Extensionpublisher which means that it will only be sent to the publisher of the app which in this case is Microsoft. This explains why it is not shown in our telemetry.

Ok, now we know why, where and how this warning appears but what can we do it about it? In our case this could be triggered 10-30 times per second which makes it really hard to troubleshoot “real” warnings and errors.

In version 21.4 and some later versions you can’t really do much 😔

I managed to solve many of them by finding different handled pattern that I could jack into before it calls sub-functions that eventually ends up with this warning.

Example

Codeunit 69182 "NBAPC Prevent 0000G95 Sub"
{
    Description = 'Purpose of this is to prevent getting warning 0000G95 in sales header';
    EventSubscriberInstance = Manual;

    [EventSubscriber(ObjectType::table, database::"Sales Header", 'OnBeforeValidateShippingAgentCode', '', false, false)]
    local procedure OnBeforeValidateShippingAgentCode(var IsHandled: Boolean)
    begin
        IsHandled := true;
    end;

    [EventSubscriber(ObjectType::table, database::"Sales HEader", 'OnBeforeValidateShippingAgentServiceCode', '', false, false)]
    local procedure OnBeforeValidateShippingAgentServiceCode(var IsHandled: Boolean)
    begin
        IsHandled := true;
    end;

    [EventSubscriber(ObjectType::table, database::"Sales HEader", 'OnBeforeGetShippingTime', '', false, false)]
    local procedure OnBeforeGetShippingTime(var IsHandled: Boolean)
    var
        SalesHeader: record "sales header";
    begin
        IsHandled := true;
    end;

#if CLEAN18
    // do nothing
#else
    [EventSubscriber(ObjectType::table, database::"Sales HEader", 'OnBeforeValidatePaymentTermsCode', '', false, false)]
    local procedure OnBeforeValidatePaymentTermsCode(var IsHandled: Boolean)
    begin
        IsHandled := true;
    end;

    [EventSubscriber(ObjectType::table, database::"Sales HEader", 'OnBeforeValidatePrepmtPaymentTermsCode', '', false, false)]
    local procedure OnBeforeValidatePrepmtPaymentTermsCode(var IsHandled: Boolean)
    begin
        IsHandled := true;
    end;
#endif
}


But then I had a call stack to this warning which was missing a satisfactionary handled pattern on the way to the warning.

That was via the intrastat app:

So to be able skip the warning this way I really have to do a ugly workaround that temporarily shuts down the intrastate report. Do I want to do that? No…

So I have to let it be for now.

But for future I filed an issue to Microsoft regarding this, Intrastat issue(?) – Handling with temporary salesheader · Issue #23041 · microsoft/ALAppExtensions (github.com)

Summary:

We got these errors be because we used temporary sales headers/sales lines as normal records. Is this a good approach? Not really nowadays but sometimes you still have to do it or it is to late to rebuild the solution.

Is it ok for Microsoft to flood our application event viewer with their internal telemetry events?  No, but I guess they are there for a reason. So instead I think they should create a rule that for every internal session.logmessage() they should have a handled pattern before it so we who are disturbed to much of it can turn it off.  That’s why I created this issue/request. We will see what happens in the future.

By the way, there are a total of five of these internal logmessage in salesheader , 0000G92, 0000G93, 0000G94, 0000G95, 0000G96, 0000G97

 
Leave a comment

Posted by on 2023-04-19 in Okategoriserade

 

Tags: , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
The BC Docs Librarian

Tips and news for AL programmers

Stefan Maroń

Dynamics 365 Business Central

James Pearson

Thoughts about Dynamics 365 Business Central, Git, Azure DevOps, PowerShell, Automated Testing, Visual Studio Code...and maybe some other stuff

Roberto Stefanetti BLOG

MVP & MCT Microsoft Dynamics 365 Business Central, Powershell, Azure, SQL Server

JoeBrown

DevOps starts with culture!

Comments for DevOps ABCs Blog

Reflections from the ERP field

DevOps ABCs Blog

Reflections from the ERP field

Dynamics 365 Business Central for Partners

Reflections from the ERP field

Freddys blog

Learn something new... - then Teach someone!

Stefano Demiliani Technical Blog

Reflections from the ERP field

David Worthington's NAV Performance Blog

Micosoft Dynamics NAV Performance Testing & Optimization

Freddys Blog

Reflections from the ERP field

Marije Brummel Blog | Business Central, Azure and more...

Design Patterns, Performance, Clean Code

Vjeko.com

Ideas in the cloud

Goprowe AB

Reflections from the ERP field

ArcherPoint

Reflections from the ERP field

The NAV Viking´s Blog

- Sharing my experience in the Dynamics NAV world

Comments for

Reflections from the ERP field

Nav Can Be Fun

Its Really Fun to Work with Microsoft Dynamics Nav / D365 Business Central

%d bloggers like this: