microsoft/navcontainerhelper

Copy-AlSourceFiles.ps1 does not copy RDLC and DOCS Files with the new report layout definition

Closed this issue · 2 comments

Describe the issue
The Copy-AlSourceFiles.ps1 procedure in BcContainerHelper is not correctly copying AL source files, specifically RDLC and DOCX layouts. This issue arises when reports in newer versions use the new way of declaring layouts as described in the Microsoft documentation.

When a report omits the legacy layout declaration line but uses the rendering section instead. The associated RDLC/DOCX file is not copied by the procedure.

Additional context

  • Example report: Reminder.Report.al
  • Example layout: Reminder.rdlc and DefaultReminderEmail.docx
  • The Reminder.Report.al does not include the legacy layout declaration line, but uses rendering section.
    image
    image
  • if ($line.Trim() -like "RDLCLayout = '*';" -or $line.Trim() -like "WordLayout = '*';") is never true
    image
  • As a result, Reminder.rdlc and DefaultReminderEmail.docx is not copied by Copy-AlSourceFiles.ps1.

I have reproduced this issue in the 6.0.17 release, and the prerelease version 6.0.18-preview1202 as well.

Could you provide the code used to repro the issue?
I can see that the code will fail in the situation you describe, but only if an alFileStructure scriptblock is provided.
Are you transferring a -alFileStructure scriptblock?, then please supply that here, thanks.

The example of the -alFileStructure scriptblock:

$SourcePath = ''
$DestinationPath = ''
$myModifiedObjects = @()                         #Define set of modified standard objects, syntax Type+ID, e.g.: $myModifiedObjects = @("table18","codeunit80")

#Definition of the file structure and naming convention:
$alFileStructure = { Param ([string] $type, [int] $id, [string] $name)
    if ($myModifiedObjects.Contains("$type$id")) {
        $folder = "Modified"
    }
    elseif (($id -ge 50000 -and $id -le 99999) -or ($id -gt 1999999999)) {
        $folder = "customizations"
    }
    else {
        $folder = "src"
    }
    "$folder\$($name).$($type).al"
}

Copy-AlSourceFiles -alFileStructure $alFileStructure -Destination $DestinationPath -Path $SourcePath -Recurse

I am using slightly modified version (which I am not permitted to share), as this one is saving all files into one folder and, as .al files. But I have reproduced the issue with this scriptblock as well. The previously mentioned layout files, if their report is using the new layout declaration, are not copied. Hope this helps. Thank you.