Hi,
I have made a codeunit that can import a csv file. It works fine on the NAV-server, when I select a file from C-drive. When I run NAV on the terminal server and select a file from C-drive, I get the message "The file C:\Temp\myFile.csv was not found".
It looks like I need to specify that my codeunit must be run on the client, but how do I do that?
My codeunit OnRun trigger starts with this:
fileName := FileMgt.OpenFileDialog('choose file','','CSV files|*.csv|All files|*.*');
IF fileName = '' THEN EXIT;
CLEAR(myFile);
myFile.OPEN(fileName, TEXTENCODING::UTF8);
myFile.CREATEINSTREAM(inStream);
0
Answers
When you use File.open(XXXX) you use server side.
The fix could be
ServerPath := FileMgt.UploadFileSilent(filename);
Myfile.open(ServerPath)