Automate your C/Side Data to AL transfer (Business central v14)

If you plan to read this post you’ve probably already converted or planned to, your C/AL solution to AL extension.

AL extension data are not sotred as C/Side even for modified existing table (exemple if you add field on customer will produce somthing like: [dbo.Cronus$Customer$your-extension-guid])

The problem is you can’t have your C/Side solution and it AL version at the same time in your base and Microsoft does not provide any tool to make the transfer.

I’m bouncing out from the following very nice post of hougaar, he made an SQL script generator allowing to bakcup the C/Side data into temp. table then import it back into extension table : Uplift Data from C/Side objects to AL extension script generator (I wasn’t able to post comment out there)

I’ve personnally used it and enhance few stuff it’s why i’m writing this. I’ve also convert it into C/AL page to avoid the need of symbol regeneration (kind of long stuff, Running C/Side and AL side-by-side).

The methodology I’ve used with a bit more detailed than original post is writed bellow. Following this methodlogy carrefully is arround 2h straight for small base and a bite more huge database/solution.


Modified version of hougaar Uplift script generator

Prerequisite

  • Business Central V14 database with your C/AL solution
  • Please Backup your base we are not responsible of any dommage
  • Admin. right on the database
  • Your C/Side solution migrate to Extension ready to publish
  • The extension target solution must match the field and table name of the C/Side. The field and table transfer is based on there names, not No.
  • Uplift Data Cside to AL script generator.
    Download .zip here with fob and source text

Methodology

  1. Install the uplift script generator page and run it (run the first page 99990 from development environment)
  2. Set your target extension GUID (available in your app.json)
    Then select the new table created by your C/AL solution you want to migrate
    Select the fields no. range added on standard table. The found result will shown in sub page
  3. Use “Generate SQL Script”, the page will generate 3 different SQL script to be executed
  4. Execute the first SQL script, this will move all C/AL solution specific data to temporary tables. The syntax checker will not recognize the renamed table select it’s totally normal.
  5. Remove all your C/AL new tables previously selected
    Remove your C/AL new field on std. table : import cronus Fob to erase them all if you’ve selected all or remove them manually if you don’t
  6. Regenerate your base symbols references with finsql command HERE or import the standard symbol from the BC installation DVD\ModernDev\[…]\System.app with
    Publish-NavApp cmdlet and option -PackageType SymbolsOnly
    Check “EnableSymbolLoadingAtServerStartup” is well enabled on your service
    Restart your service
  7. Execute powershell cmdlet Sync-NAVTenant -ServerInstance <BC14> -Mode forceSync
  8. You have now a clean standard v14 base with temp table containing your solution data
    Publish and install your extension solution (please restart your service again if any symbol or metadata error occur)
  9. Execute the second SQL Script to import the temp table data into extension table
    If your extension have less fields than original C/Side solution, some SQL update will have to be modified manually in order to remove them (didn’t find easy SQL command to avoid this problem)
    Check if your data is accessible from BC user interface
  10. If all is done as expected, you can remove temp table with the third SQL script and remove the uplift pages 99990 and 99991.
  11. (Optional) Relax yourself

Please feel free to use and contriube

6 Comments

    • Ok thank you. Basicaly they are new subpage, some SQL script modifications and sécurity check before script generation and extension converted to c/Al to avoiding symbol reloading

  1. Thank you for your enhancement.
    I’ve got one dude:
    I need to export data from BC14 to BC15. In order to get it, i have to install in BC15 the extension created in BC14 ( with data), haven’t I?

Leave a Reply to Maarten Gerritsen Cancel reply

Your email address will not be published. Required fields are marked *