AX / D365FO – create Text file and download locally in the web browser with File::SendStringAsFileToUser #d365fo #ax #msdyn365fo

class test
    public static void main(Args _args)
        str filePath;
        str fullFilePath;
        str fileContent = "File Content exmple";

        //File path + name
        filePath = System.IO.Path::GetTempPath();
        fullFilePath = filePath + 'f' + guid2str(newGuid()) + '.txt';
        //Save file and show in the web browser  
        File::SendStringAsFileToUser(fileContent, fullFilePath);
        info('File Path : ' + fullFilePath);


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s