Downgrade Extension (OnPrem)
There is no built-in feature for downgrading an extension. Once you have upgraded an extension to a newer version, you will not be able to go back to the previous version through the user interface. But there can be a possible way through PowerShell and some SQL.
It's important to keep in mind that downgrading an extension may cause compatibility issues and data loss!
First, you need to be sure that the extension that you are downgrading to is compatible with the other installed extensions. If it’s not then you need to find the correct apps, if they need to be downgraded too, you need to follow the same steps.
It's important to note that downgrading an extension through PowerShell and SQL is not a recommended approach, and it should only be done by experienced users who are familiar with the risks and potential issues that may arise. It's also important to backup your data before attempting to downgrade an extension in case of data loss.
In the description the following terms will be used:
- New: The extension with the version you are downgrading from.
- Old: The extension with the version you are downgrading to.
- Database: SQL Database containing the environment.
The process is as followed:
- Find the app you need to downgrade.
- Uninstall the new extension
- Publish the old extension
- Unpublish the new extension
- Open SQL Server Management System
- Find the database
- Open and find the table $ndo$navappuninstalledapp
- In the table find the extension you wish to downgrade
- Change its version number to the version of the old extension. (You can use the below Script)
Update version in database (PowerShell)
To update the version no in the database you can use the below script. Be aware that you ned to uninstall the extension first.
The script uses the Invoke-Sqlcmd
commandlet to connect to the specified SQL server and database, and it runs a SELECT query to retrieve the information of the extension you wish to downgrade. It prompts the user to confirm the version update and, if the user confirms, it runs an UPDATE query to update the version number of the extension in the database.
The script also includes some variables that need to be set before running the script:
- $Database: the name of the database containing the environment
- $DatabaseServer: the name or IP of the SQL server
- $AppId: the AppId of the extension you want to downgrade
- $OldVersion: the version number you want to downgrade to
#-------------------------------PRE STEP-------------------------------
$Database = ''
$DatabaseServer = ''
$AppId = ''
$OldVersion = ''
#-------------------------------DO NOT EDIT UNDER THIS LINE-------------------------------
$ConnectionString = "Server=$($DatabaseServer);Database=$($Database);Trusted_Connection=True;"
$SelectQuery = "SELECT * FROM [$($Database)].[dbo].[`$ndo`$navappuninstalledapp] WHERE [appid] = '$($AppId)'"
Invoke-Sqlcmd -Query $SelectQuery -ConnectionString $ConnectionString | Format-Table
$ContinueExecution = Read-Host -Prompt 'Do you wish to update the selected extension version? (Y/N)'
if ($ContinueExecution.ToUpper() -eq 'Y') {
$UpdateQuery = "UPDATE [$($Database)].[dbo].[`$ndo`$navappuninstalledapp] SET [version] = '$($OldVersion)' WHERE [appid] = '$($AppId)'"
Invoke-Sqlcmd -Query $UpdateQuery -ConnectionString $ConnectionString
Write-Host "The version of the selected extension is updated" -ForegroundColor Green
}