Reader small image

You're reading from  Dynamics 365 Business Central Development Quick Start Guide

Product typeBook
Published inAug 2018
PublisherPackt
ISBN-139781789347463
Edition1st Edition
Concepts
Right arrow
Authors (2):
Stefano Demiliani
Stefano Demiliani
author image
Stefano Demiliani

Stefano Demiliani is a Microsoft MVP on Business Applications and Azure, MCT, Microsoft Certified Solution Developer (MCSD), Azure Certified Architect, and an expert in other Microsoft related technologies. His main activity is architecting and developing enterprise solutions based on the entire stack of Microsoft technologies (mainly focused on ERP and serverless applications). He has worked with Packt Publishing on many IT books related to Azure cloud applications and Dynamics 365 Business Central and is a frequent speaker at IT conferences around Europe. In his free time Stefano is also a runner and a cyclist.
Read more about Stefano Demiliani

Duilio Tacconi
Duilio Tacconi
author image
Duilio Tacconi

Duilio Tacconi is a Microsoft Dynamics NAV/Microsoft Dynamics 365 Business Central Escalation Engineer at Microsoft EMEA Customer Support & Services (CSS). He joined Microsoft in 2008 after working in a customer IT department with a focus on system administration and development. Despite graduating with the highest score in Agricultural Science in 1996, he is in the ERP circuit since 1998 as developer and system implementer for several companies with Microsoft and non-Microsoft technologies. Currently, he is a subject matter expert in EMEA for RDLC Report development and one of Microsoft EMEA CSS reference for Managed Service for Partners (MSfP). Three times IronMan finisher, Duilio lives in Cernusco Sul Naviglio (Italy) with his beloved wife Laura and his 2 years old son Leonardo.
Read more about Duilio Tacconi

View More author details
Right arrow

Installing and upgrading codeunits


When you develop an extension, there's also an important aspect to take care of: installation and upgrading operations. When an extension is installed or upgraded, you often need to perform certain operations on data, such as populating new data and restoring existing ones. These tasks can be achieved by writing extension-install-and-upgrade code.

In this type of code, you can access the extension properties (such as version, name, publisher, and dependencies) by using the NAVApp.GetCurrentModuleInfo() and NAVAPP.GetModuleInfo() methods.

The install logic can be written by creating an install codeunit, that is, a codeunit with SubType = Install.

An install codeunit has two main system triggers:

  • OnInstallAppPerCompany(): Includes code for company-related operations. Runs once for each company in the database.
  • OnInstallAppPerDatabase(): Includes code for database-related operations. Runs once in the entire install process.

This is an example of an Install Codeunit...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Dynamics 365 Business Central Development Quick Start Guide
Published in: Aug 2018Publisher: PacktISBN-13: 9781789347463

Authors (2)

author image
Stefano Demiliani

Stefano Demiliani is a Microsoft MVP on Business Applications and Azure, MCT, Microsoft Certified Solution Developer (MCSD), Azure Certified Architect, and an expert in other Microsoft related technologies. His main activity is architecting and developing enterprise solutions based on the entire stack of Microsoft technologies (mainly focused on ERP and serverless applications). He has worked with Packt Publishing on many IT books related to Azure cloud applications and Dynamics 365 Business Central and is a frequent speaker at IT conferences around Europe. In his free time Stefano is also a runner and a cyclist.
Read more about Stefano Demiliani

author image
Duilio Tacconi

Duilio Tacconi is a Microsoft Dynamics NAV/Microsoft Dynamics 365 Business Central Escalation Engineer at Microsoft EMEA Customer Support & Services (CSS). He joined Microsoft in 2008 after working in a customer IT department with a focus on system administration and development. Despite graduating with the highest score in Agricultural Science in 1996, he is in the ERP circuit since 1998 as developer and system implementer for several companies with Microsoft and non-Microsoft technologies. Currently, he is a subject matter expert in EMEA for RDLC Report development and one of Microsoft EMEA CSS reference for Managed Service for Partners (MSfP). Three times IronMan finisher, Duilio lives in Cernusco Sul Naviglio (Italy) with his beloved wife Laura and his 2 years old son Leonardo.
Read more about Duilio Tacconi