A Windows version 10.0.20348-based image is incompatible with a 10.0.19044 host

While installing new docker image I am getting this error

DockerDo : a Windows version 10.0.20348-based image is incompatible with a 10.0.19044 host

This issue has been fixed on latest BcContainerHelper module

solution

uninstall previous versions of BcContainerHelper and install new version

Remove-Module BcContainerHelper
Uninstall-module bccontainerHelper -allversions
Install-module bccontainerhelper

Advertisement

Business Central Create New Extension and Push to GitHub Repository

Git is a distributed version-control system for tracking changes in source code during software development, following video explain how to create new business central extension project  and push extension to git repository

Steps

  1. Create new Project in visual studio code
  2. Create new Repository in GitHub
  3. Check visual studio code and confirm the git enabled
  4. Initialize Repository in visual studio code
  5. Commit changes
  6. Configure remote repository
  7. Synchronize the changes to GitHub

 

Business Central Install Multiple Extensions using powershell script

One of our customer having 20 + extensions ,while setting up new environment  it’s  very difficult to publish and install all extensions one by one , so I created one powershell script to install multiple extensions . Please check the video for more details ,thanks

Script folder

Business Business Central Administration Shell


# Code to get current path 
function Get-ScriptDirectory {
if ($psise) {Split-Path $psise.CurrentFile.FullPath}
else {Split-Path $script:MyInvocation.MyCommand.Path}
}
# Code to get current path 
$Folder = Get-ScriptDirectory
$ServiceName = Read-Host "Service Name ? :"

$DeveloperLicense = $Folder +'\Developer.flf'
$CustomerLicense = $Folder +'\Customer.flf'

Import-NAVServerLicense -ServerInstance $ServiceName -LicenseFile $DeveloperLicense
$confirmation = Read-Host "Do you want to Uninstall all extensions (y) ? :"
if ($confirmation -eq 'y') {
$Apps = Get-NAVAppInfo -ServerInstance $ServiceName| Where Publisher -ne 'Microsoft'

foreach ($App in $Apps) {
$App | Uninstall-NAVApp -Force
$App | Sync-NAVApp -ServerInstance $ServiceName -force
$App | UnPublish-NAVApp 
} 
write-host " Apps uninstalled Press any key to continue..."
[void][System.Console]::ReadKey($true)
}

Sync-NAVTenant -ServerInstance $ServiceName -Mode ForceSync -force

write-host " Sync Completed Press any key to continue..."
[void][System.Console]::ReadKey($true)

Get-ChildItem -Path (Join-Path $Folder $_) -Filter "*.app" | ForEach-Object { 
Publish-NAVApp -ServerInstance $ServiceName –SkipVerification -Path $_.FullName
}

write-host " New Apps published Press any key to continue..."
[void][System.Console]::ReadKey($true)

Sync-NAVTenant -ServerInstance $ServiceName -Tenant Default -Mode ForceSync -force

write-host " Sync Completed Press any key to continue..."
[void][System.Console]::ReadKey($true)

$Apps = Get-NAVAppInfo -ServerInstance $ServiceName| Where Publisher -ne 'Microsoft' 
foreach ($App in $Apps) { 
$App | Sync-NAVApp -ServerInstance $ServiceName -force 
$App | Install-NAVApp 
}

Sync-NAVTenant -ServerInstance $ServiceName -Tenant Default -Mode ForceSync -force 
Import-NAVServerLicense -ServerInstance $ServiceName -LicenseFile $CustomerLicense

$confirmation = Read-Host "Do you want to restart nav service (y) ? :"
if ($confirmation -eq 'y') {
Stop-NAVServerInstance -ServerInstance $ServiceName -Force
Start-NAVServerInstance -ServerInstance $ServiceName -Force
}


 

Modern Development Environment Issues

While confuguring the visual studio codes hit few errors

  • Could not open the specified startup page. Please check that the server configuration key PublicWebBaseUrl has been properly set

we need to update the public URL from powershell or administor  tool and restart the service

Import-Module 'C:\Program Files\Microsoft Dynamics NAV\110\Service\NavAdminTool.ps1'

Set-NAVServerConfiguration -KeyName PublicWebBaseURL -ServerInstance Dynamicsnav110 -KeyValue http://localhost:8080/dynamicsnav110
  • Debug app hit following error 

After publish the app ,its working fine , inorder to debug the application (F5) from visual studio code we need to disable CAS policy,

open  Server config file C:\Program Files\Microsoft Dynamics NAV\110\Service\Microsoft.Dynamics.NAV.Server.exe.config update netfx40_legacysecuritypolicy to false ,  restart the service and try again


<netfx40_legacysecuritypolicy enabled="false"/>

Nav 2016 Preview Report without Request Page

ReportREPORT.EXECUTE Runs a report in preview or processing only mode without running the request page. The function gets the request page parameter values as an input parameter string. This is the new reporting function added on 2015 version

Requirement : preview Sales invoice report without the request page

  •  Create New codeunit to generate the XML request string

  5

  • Run Codeunit and apply the filter on request page  > OK >Copy the message to text

1

XML string

2

  • Copy Message to text and replace parameter with %1

3

  • Create New Action on posted sales invoice page

4

  • Posted sales invoice page

6

Dynamics Nav 2016 Enable NavUserPassword authentication in simple steps

This post describes the simple steps to enable the NavUserPassword authentication

 

Run Script as administrator

Create New Certificate

  • Run mmc.exe to open management console
  • File -> Add/Remove Snap-in

2

  • Select Certificate -> Add -> Select Computer account finish

Select Certificate

  • New Certificate created on Personal Certificate folder with 10 year validity

5

  • Copy Certificate to Trusted Root Certification Authorities

6

  • Create New service with login account windows user

Create New Nav Service

  • Copy certificate thumbprint   from the certificate

Right click certificate open Details tab select Thumbprint Copy certificate Thumbprint

Thumbprint

Update the certificate thumbprint and credential type NavUserPassword -> Restart the service

8

  • Create New NavUserPassword user in Navsion NavPasswordUser

 

  • Update  Client Configuration file New Service  details and authentication Details

12

  • Nav Client Open with NavUserPassword login Screen

NavUserPasswordLogin

  • Client opened with navuser password

Nav Client

 

 

Navision Schedule Report warning There is no running job queue for scheduled reports.

Scheduled reports are entered in the job queue and processed at the scheduled time, similar to other jobs. If we choose to save the report to a file, then the processed report will sent to the Report Inbox,

While Scheduling the report, the scheduler page hitting warning message There is no running job queue for scheduled reports. 

2

1

This is the standard error , you have to create new job queue with  Job queue Category filter blank . Start Job queue and try again2

Schedule Adjust Cost report on navision 2013 and higher versions

Job queues enables users to schedule and run specific reports and codeunits. You can set jobs to run one time, or recurring basis

Previous versions we have to install  NAS to process job Queue  , 2013 and higher versions default service will start process this job queue entries .

  • Create New Job Queue Category ADJUSTCOST

Job Queue Category

  • Create New Job Queue ADJUSTCOST
  •  Select Job Queue Category to ADJUSTCOST
  • Start Job Queue

Make sure the running User ID has enough permission to run the report

Job Queues

  • Create New Job Queue Entry
  • Object Type  Report
  • Report ID 795  Adjust Cost – Item Entries
  • Select Job Category ADJUSTCOST
  • Recurrence Tab Select days and Starting Time
  • Set Status to Ready
  • testing you may change the Earliest Start Date /Time

Job Queue Entry

  • Job Queue Log Details
  • You may check the error  and job status  details on job queue log entries
  • Select Job –> log entries

Adjustcost_log

Implementing Nav 2016 Workflow Events and Response for Sales Invoice auto send email

In this post we will create a new Workflow Event . The event  tied to the Dynamics NAV  Sales post functionality, While posting the sales invoice based on the workflow conditions program will auto send email and update the pdf report  on report inbox

You may download the object and workflow file from Dropbox Link 

Scenarios
1 – Create a workflow event
The scenario is to define an event based on the on after post trigger of the sales post and expose that event as a workflow event.

2 – Create a workflow response
The scenario  is to define a Send email and update the report to report  inbox  .

3 – Enable the workflow & response in the NAV system
This is to show managing workflow events & responses from a Dynamics NAV system to build a workflow.

 

1 – Create a workflow event

  1. Create a new codeunit
  2. Create a helper function OnPostCode .  This function will return a code which is used by the workflow engine.
  3. Give the function return value of Code, length 128.
  4. Create New function AddEventToLibrary subscribe the function from Workfkow event handling codeunit Check the screenshot
  5. Create New function  OnPOstSalesDoc Subscribe to sales post codeunit

1

2 – Create a workflow response

 

  1. Create a helper function RunSendEmailResponseCode .  This function will return a code which is used by the workflow engine.
  2. Give the function return value of Code, length 128.
  3. Create New function AddResponseToLibrary subscribe the function from Workfkow Response  handling codeunit Check the screenshot
  4. Create New function   ExicuteResponse subscribe the function from Workfkow Response  handling codeunit Check the screenshot

 

2

Created New function to send the email

Email function

 

3 – Enable the workflow & response in the NAV system

Crate New workflow Category with code MYWF and description My Workflow

WorkflowCategory

New workflow created with condition  amount>1000

New workflow

 

 

 

Report inbox updated after post sales invoice

reportbox

Auto email from nav

Email

Error when exporting budget to Excel – The call to member Add failed. Microsoft Office Excel returned the following message: That name is not valid.

While exporting budget from nav 5.1 version system hit following error message

The call to member Add failed. Microsoft Office Excel returned the following message: That name is not valid.

Error

 

Error hitting on  report 82 Export Budget to Excel Line ExcelBuf.CreateRange(ColumnDimCode[i]) Line

This is the standard Nav 5.1  report  bug and Microsoft has already fixed this issue on 2009 version , the problem occurs when exporting a dimension code that contains blank space (or special characters) ,  check the screenshot

 

Error

Update the two lines to Nav 5.1  version object and export again.

 

Creating Matrix Reports in Nav 2013 R2

In this article we are going to see how to create a Matrix Report ,

Matrix reports display grouped data and summary information. You can group data by multiple fields or expressions in row and column groups.A matrix  report grows horizontally and vertically on the page

lets see how to create one  inventory  matrix report based on location  and item

Create one new report with data Item ledger entry

1

Open Visual Studio Report designer add matrix control

1

Select Row group field on Rows and Column Group fields in Column

Now I am selecting Item No as Row Group,  Column group as Location code  and Data as Quantity

3

Report Output

4

next insert Item description row after the item Number ,  Right Click Item No text box and select inside the group right and insert description field in the new text box

5

Insert Row  Total in the report, Right Click Item No text box and select Add Total After

6

Insert  Column Total  in the report,,  Right Click Location text box and select Add Total After

7

Final output grouped by item no and and location

8

you can download sample report from here 

How to save outlook attachments files from Navision ?

020713_1706_ReadingOutl1.jpgwe have one new requirement to read outlook from Navision

Details

User will send one text file. The text file will be on specific format, then program should read new mails from outlook and  download the file to a pacific place . Read the text file and creates item journals and posts it.

The main point program should download the attachment file, through outlook automation we can download the attachment .

Here is one example for downloading the  mail

Create the automation variables check the image

outlook automation

Outlook mail  Codeunit

IF ISCLEAR(outlookapplication) THEN
CREATE(outlookapplication,FALSE);
outlooknamespace:=outlookapplication.GetNamespace('MAPI');
outlooknamespace.Logon('Outlook','',TRUE,TRUE);
outlookMAPIFolder:=outlooknamespace.GetDefaultFolder(6);  //6 means inbox
outlookitems:=outlookMAPIFolder.Items;
Findcriteria:='[ReceivedTime]>'+Text001+FORMAT(TODAY-1)
+Text001+' AND [Unread] =true ';
outlookitems:=outlookMAPIFolder.Items.Restrict(Findcriteria);
I:=1;
endofloop:=outlookitems.Count;
WHILE I<=endofloop DO
BEGIN
outlookemail:=outlookitems.Item(I);
outlookAttachments:=outlookemail.Attachments;
AttCount:=outlookAttachments.Count ;
IF  AttCount>0 THEN
FOR K:=1 TO AttCount DO BEGIN
Path:='E:\Outlook Attachment path\'+outlookAttachments.Item(K).FileName;
outlookAttachments.Item(K).SaveAsFile(Path);
END;
I+=1;
END;

create one Outlook Attachment path folder and run the codeunit

now the codeuint will filter last two days  unread mails from outlook and all the attachment files will save to E:\Outlook Attachment path\  

you can download the object file from here

Tips

Find criteria we can use different conditions

eg: [ReceivedTime]>’18/08/13′ AND [Unread] =true  AND [Subject] = ‘item’

check the link

http://msdn.microsoft.com/en-us/library/office/aa210275%28v=office.11%29.aspx

How Create Excel Pivot table report from Navision?

microsoft-excel-logoA pivot table is a data processing tool used to query, organize and summarize data or information between spreadsheets, tables or databases. Dragging and dropping fields into a pivot table facilitates rotational, or pivotal, structural changes.

Using excel automation we can create the excel  Pivot table report from  Navision

This is one example to analyze the customer ledger entries records in table 21

Create one blank report with dataitem  Cust. Ledger Entry   and update the reports Processonly status to true

Add below variable’s in report  (click the image to view the enlarge image)

pivot table

Cust. Ledger Entry - OnPreDataItem()
CREATE(Excel);
Excel.Workbooks.Add();
Sheet:=Excel.ActiveSheet;
Sheet.Name := 'CUST_LEDGER';
Window.OPEN(Text00001);
Excel.Visible(TRUE);
I:=5;
Sheet.Range('A1').Value:= "Cust. Ledger Entry".TABLECAPTION;
Sheet.Range('C1').Value:= 'USER ID ';
Sheet.Range('D1').Value:=USERID;
Sheet.Range('C2').Value:= 'DATE ';
Sheet.Range('D2').Value:=TODAY;
UpdateExcelrange;
Sheet.Range(ExcelRange[1]).Value:="Cust. Ledger Entry".FIELDCAPTION("Cust. Ledger Entry"."Entry No.");
Sheet.Range(ExcelRange[2]).Value:="Cust. Ledger Entry".FIELDCAPTION("Cust. Ledger Entry"."Posting Date");
Sheet.Range(ExcelRange[3]).Value:="Cust. Ledger Entry".FIELDCAPTION("Cust. Ledger Entry"."Customer No.");
Sheet.Range(ExcelRange[4]).Value:=Cust.FIELDCAPTION(Cust.Name);
Sheet.Range(ExcelRange[5]).Value:="Cust. Ledger Entry".FIELDCAPTION("Cust. Ledger Entry"."Document No.");
Sheet.Range(ExcelRange[6]).Value:="Cust. Ledger Entry".FIELDCAPTION("Cust. Ledger Entry".Description);
Sheet.Range(ExcelRange[7]).Value:="Cust. Ledger Entry".FIELDCAPTION("Cust. Ledger Entry"."Global Dimension 1 Code");
Sheet.Range(ExcelRange[8]).Value:="Cust. Ledger Entry".FIELDCAPTION("Cust. Ledger Entry"."Global Dimension 2 Code");
Sheet.Range(ExcelRange[9]).Value:="Cust. Ledger Entry".FIELDCAPTION("Cust. Ledger Entry"."Amount (LCY)");
Sheet.Range(ExcelRange[10]).Value:='YEAR';

UpdateExcelrange is a  function to update the Excelrange array variable

in excel YEAR column will update with month + year such as if  1st January 2013 then year value will be Jan 2013


Cust. Ledger Entry - OnAfterGetRecord()
CLEAR(Cust);
IF Cust.GET("Cust. Ledger Entry"."Customer No.") THEN ;
K:=ROUND(((I-5)/"Cust. Ledger Entry".COUNT) * 10000,1);
Window.UPDATE(1, K);
"Cust. Ledger Entry".CALCFIELDS("Cust. Ledger Entry"."Amount (LCY)");
UpdateExcelrange;
Sheet.Range(ExcelRange[1]).Value:="Cust. Ledger Entry"."Entry No.";
Sheet.Range(ExcelRange[2]).Value:="Cust. Ledger Entry"."Posting Date";
Sheet.Range(ExcelRange[3]).Value:="Cust. Ledger Entry"."Customer No.";
Sheet.Range(ExcelRange[4]).Value:=Cust.Name;
Sheet.Range(ExcelRange[5]).Value:="Cust. Ledger Entry"."Document No.";
Sheet.Range(ExcelRange[6]).Value:="Cust. Ledger Entry".Description;
Sheet.Range(ExcelRange[7]).Value:="Cust. Ledger Entry"."Global Dimension 1 Code";
Sheet.Range(ExcelRange[8]).Value:="Cust. Ledger Entry"."Global Dimension 2 Code";
Sheet.Range(ExcelRange[9]).Value:="Cust. Ledger Entry"."Amount (LCY)";
Sheet.Range(ExcelRange[10]).Value:=FORMAT("Cust. Ledger Entry"."Posting Date",0,'')+' '+
FORMAT("Cust. Ledger Entry"."Posting Date",0,'');

the Pivot table is creating on the on post data item trigger

Updated one option  field in request form , user can select customer or dimension, based on the choice the pivot table row values will change

Cust. Ledger Entry - OnPostDataItem()
xlPivotCache:=Excel.ActiveWorkbook.PivotCaches.Add(1,'CUST_LEDGER!A6:J'+FORMAT(I));
xlPivotCache.CreatePivotTable('','PivotTable1');
Sheet :=Excel.ActiveSheet();
xlPivotTable := Sheet.PivotTables('PivotTable1');
Sheet.Name := 'Cust_Ledger_Pivot';
xlPivotField := xlPivotTable.PivotFields('YEAR');
xlPivotField.Orientation := 1;
xlPivotField.Position := 1;
IF "Pivot Base"="Pivot Base"::Customer THEN
xlPivotField := xlPivotTable.PivotFields(Cust.FIELDCAPTION(Cust.Name))
ELSE IF "Pivot Base"="Pivot Base"::Dimension THEN
xlPivotField := xlPivotTable.PivotFields("Cust. Ledger Entry".FIELDCAPTION("Cust. Ledger Entry"."Global Dimension 1 Code"));
xlPivotField.Orientation := 1;
xlPivotField.Position := 2;
xlPivotField := xlPivotTable.PivotFields("Cust. Ledger Entry".FIELDCAPTION("Cust. Ledger Entry"."Amount (LCY)"));
xlPivotTable.AddDataField( xlPivotField);
xlPivotField := xlPivotTable.DataPivotField;
xlPivotField := xlPivotTable.PivotFields('YEAR');
xlPivotField.Orientation := 2;
xlPivotField.Position := 1;

pivot  table output

12

code for update excel range function

UpdateExcelrange()
I+=1;
ExcelRange[1]:='A'+FORMAT(I);
ExcelRange[2]:='B'+FORMAT(I);
ExcelRange[3]:='C'+FORMAT(I);
ExcelRange[4]:='D'+FORMAT(I);
ExcelRange[5]:='E'+FORMAT(I);
ExcelRange[6]:='F'+FORMAT(I);
ExcelRange[7]:='G'+FORMAT(I);
ExcelRange[8]:='H'+FORMAT(I);
ExcelRange[9]:='I'+FORMAT(I);
ExcelRange[10]:='J'+FORMAT(I);

you can download the object and sample output from here

Tips

For any other update use macro functionality from excel

steps

  1. start  record the macro
  2. update the required changes in excel file
  3. Stop macro
  4. Edit macro then you will get  the visual basic code check the imageCapture
  5. Convert VB code to Cal code  update navision