DEVELOPER'S BLOG

File Upload in Common Dialog Management02 sep2016

Category: Quick Tips Tags: file upload, upgrade, migration

Quick recipe how to migrate a standard OpenFile Dialog with File Extension from Classic Client to RTC.

In the Classic client a call to open and upload a file is handled in Codeunit 412 Common Dialog Management in the function OpenFile. An example of a code snipped may look like this:

Link := CommonDialogMgt.OpenFile('',Link,4,'',0);

The result will be like this:

To achieve a similar result in the RTC use the Codeunit 419 - File Management and the function OpenFileDialog. An example of such a function may look like this:

_Link := FileManagement.OpenFileDialog('Select File to link a Path',Link,'comma separated files (*.csv)|*.csv');

The function uses a .NET Library to handle file dialogs. A _Link is a text Variable that can be used in further assignments (e.g. when the file has been selected).

The result you can see below:

In this example a function call has been executed from the OnLookup trigger of the field Link

_Link := FileManagement.OpenFileDialog('Select File to link a Path',Link,'comma separated files (*.csv)|*.csv');
IF _Link <> '' THEN
  Link := _Link;

View Konrad Buczkowski's LinkedIn profile Monika Wichrowska