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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

How to execute code when my extension is uninstalled

(0) ShareShare
ReportReport
Posted on by 5

Hello,

In BC20 I'm trying to execute code before my extension gets uninstalled. Is there a way to do this?

I can't seem to find a trigger which executes at this event.

pastedimage1652774497685v1.png

Thanks

Severin

I have the same question (0)
  • Binesh Profile Picture
    7,885 on at

    Hi,

    You can subscribe the Page "Extension Details'OnAfterActionEvent', 'Uninstall' action as shown below screenshot.

    pastedimage1652810495775v1.png
  • Severin S Profile Picture
    5 on at

    Hi,

    Thank you for the response.

    The OnAfterActionEvent didn't work, but the the OnBeforeActionEvent worked.

    I can use this to trigger my code.

    The problem with this way of triggering my code is, that I have no way to check if the uninstalled App/Extension is mine.

    If I use the "Published Application"-Parameter I get an error: "The application object or method 'Published Application' has scope 'OnPrem' and cannot be used for 'Extension' development".

    I can't switch my Environment to an OnPrem-Environment.

    Do you know any other way how I can check if the uninstalled app is my app?

  • Suggested answer
    Alec Gray Profile Picture
    30 on at

    Hi,

    Have you tried using the 'Nav App Installed App' record type?

    Code below:

    codeunit 90137 ExtensionDetails
    {
        [EventSubscriber(ObjectType::Page, Page::"Extension Details", 'OnBeforeActionEvent', 'Uninstall', true, true)]
        local procedure MyProcedure()
        var
            NavApp: record "NAV App Installed App";
    
        begin
            if NavApp.Name = 'My App' then begin
                //[DO STUFF]
            end;
        end;
    }

    Please mark this answer as accepted if it works for you 1f603.svg

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,238

#2
YUN ZHU Profile Picture

YUN ZHU 773 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 630

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans