Fastly publish extension from Nav 2018 RTC

If you already working with Nav 2018 extension, you know you have to go through powershell command to import new .app in Nav : How to: Publish and Install Extention

I developped small function to allow you to do this fastly through RTC on Extention management page.

A new button “Import” ask an app file with a file browser then execute the powershell function with admin right to puslish the app. The button “Remove” can be used as Unpublish-navapp function for the selected extension on the page.

Nb : This powershell functions need administator rights that can’t be afford with PowershellRunner (Dotnet) that’s why I automation is used here.

Page 2500 Extention Management.zip

Import - OnAction()
TxtLAppFile:= CduLFileMgt.OpenFileDialog('NAV Extention','*.app','');

IF TxtLAppFile = '' THEN 
  EXIT;

TxtLPowerShell := 'Import-Module ''' + APPLICATIONPATH + 'NavAdminTool.ps1'';';
TxtLPowerShell += 'Publish-Navapp -ServerInstance ' + GetInstanceService + ' -skipverification -path ''' + TxtLAppFile + '''';

CREATE(Shell, TRUE, TRUE);
Shell.Run('powershell.exe "Start-Process powershell \"-NoProfile -ExecutionPolicy Bypass -Command ' + TxtLPowerShell + '\" -Verb RunAs; ');
CLEAR(Shell);

CurrPage.UPDATE;

Remove - OnAction()
CurrPage.SETSELECTIONFILTER(RecLExtention);
IF RecLExtention.FINDFIRST THEN BEGIN
  IF RecLExtention.Installed THEN
    ERROR(CstLInstalled);

  TxtLPowerShell := 'Import-Module ''' + APPLICATIONPATH + 'NavAdminTool.ps1'';';
  TxtLPowerShell += 'Unpublish-Navapp -ServerInstance ' + GetInstanceService + ' -Name ''' + RecLExtention.Name + '''';

  CREATE(Shell, TRUE, TRUE);
  Shell.Run('powershell.exe "Start-Process powershell \"-NoProfile -ExecutionPolicy Bypass -Command ' + TxtLPowerShell + '\" -Verb RunAs; ');
  CLEAR(Shell);

  CurrPage.UPDATE;
END;

 

 

One Comment

  1. Pingback: Fastly publish extention from Nav 2018 RTC | PA

Leave a Reply

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