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

Announcements

No record found.

News and Announcements icon
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,887 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,003 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,225 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,192

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans