In ax previous versions, when we ran batch processes that generated files, we could configure it to save files to a local directory.
At F&O we can’t do It, but we have a couple of alternatives to achieve It. One option would be to save It In a previously configured SharePoint route, an another, which I’ll explain below, would be to save It as an attached document.
This development consists of creating an execution history table related to the batch process and including the generated file, in this case an excel, as a document attached to that record.
In our table we will create the fields we want, in this case, the execution date, the user who executes it, and the date range in which the batch process was executed. We will also need the corresponding form.

In the batch process we will use the JAExcelHelper class to create the excel that we will add as an attachment.
• First, we will initialize the class, and add the name of the file and the tab of our excel.

• Secondly, we will initialize the header of our excel columns.

• Thirdly, we will fill in the information in our excel.

• Finally, we will create our record in the history, and we will attach the excel as an attached document.
– We will create our record

– We will save the created excel in a MemoryStream object that we will need later. To do this it will be necessary to create a method that returns the memoryStream of the file.
– And we will attach it

When we execute our process, it will create the record in the table we have created.

And it will attach the excel that we have generated in our process as an attached document.

This way, we achieve a well-organized and accessible execution history, with the Excel file directly attached to the record. All within the system itself, without complications.
It’s a simple, practical solution that can be easily adapted to other processes or file types. And the best part: no need to rely on external paths or complex configurations.




