microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
737 stars 243 forks source link

Drop Table on Business Central #3479

Closed robertoscaringella closed 6 years ago

robertoscaringella commented 6 years ago

Hi, I created/published/Installed an app su Business Central on the live Enviroment by the Extension Management. This app have a new table 50100:

table 50100 Preventivi { DataClassification = ToBeClassified;

fields
{
    field(1;ID; Integer)
    {
        DataClassification = ToBeClassified;
        Caption = 'ID_Preventivo';
    }
    field(2;No_Customer;Code[20])
    {
        DataClassification = ToBeClassified;
        Caption = 'No_Customer';
        TableRelation = Customer;
    }
}

keys
{
    key(PK; ID)
    {
        Clustered = true;
    }
}   

} Now I need to change some property, like a "AutoIncrement = true" but the system refuse the modification. I need to change the primary key because I cannot work on a SandBox Enviroment because we are try to connect PowerApp to the business central, but PowerApp can create a connection only with Live Enviroment.

How I can drop the custom table on the live enviroment? I tried with "schemaUpdateMode": "Recreate" but doesn't work. Do you know why the SandBox Enviroment is not visible from the PowerApp?

Thank you. Roberto.

robertoscaringella commented 6 years ago

Hi, I need some update, because this integration between Business Central and PowerApp is business-critical for my customer.

So, I need to know:

Thank you, Roberto.

kalberes commented 6 years ago

The answer is ':' You cannot drop a table in the live environment. Once an extension is synchronized to a tenant, then all future versions must be schematically backwards compatible. In a sandbox environment you can bypass these breaking changes via the 'clean' mode of extension sync. (E.g. Sync-NavApp -Mode Clean, or VSCode 'Recreate').

The consequence of using the above is that we remove all schematic elements that the extension added. I.e. drop all tables/fields etc added by the extension, which means that you lose all data. There are still a few options for getting around this problem.

  1. 'Abandon' the table. (New version of the extension)

    • Obsolete the table with the 'ObsoleteState/Reason' properties
    • Create a new table that is very similar, except has the PK changes you desire
    • Update all references/usages of the table to the 'new' table
    • Upload new version
  2. Start over with a 'new' extension

    • Uninstall/Unpublish the uploaded extension from the UI
    • Change the AppId & Version of your extension
    • Update the table to contain the new schema changes
    • Upload new version

In both cases, you are also 'abandoning' the data that might already exist in the table, if this data is to be preserved, then you would need to write upgrade code to port data into the new tables. (And include a dependency on the old extension in the case of 2)

robertoscaringella commented 6 years ago

Ok, thank you.

But the reason about this problem is the lacking of connection between BC Sandbox and PowerApp. So, I need a solution for develop an BCApp visible to PowerApp but not installed/published on the live Enviroment.

I tried to Install/Publish because I didn't found history/documentation about the visibility of BC from PowerApp, and for Business/Commercial reason I was forced to try on live Enviroment.

Microsoft push to use all the Dynamics 365 Ecosystem, so I need to work on the Sandbox enviroment without "dirty" the live enviroment and see all on PowerApp.

So please, help me for to find a solution.

Thank you in advanced.

Roberto.

robertoscaringella commented 6 years ago

Hi, in the PowerApps Community, answer that currently it's possible create a connection only to Dynamics 365 Production environment from an app within PowerApps.

https://powerusers.microsoft.com/t5/General-Discussion/Connect-PowerApp-with-Dynamics-365-Business-Central-Sandbox/m-p/156423#M52830

Thank you, Roberto.