Hello,
I have gone through your code and question but not getting proper idea that what you want to do in this operation but as per my assumption, before you click on the action you have some data into CFS_EXPORTTABLENETRY table and you wanted to get the data by filtering from "G/L Entry", if my assumption is true then you must change the code as per below.
- Definitely your exported file will be blank because before you Setrange the G/L Entry you must need to get the CFS_EXPORTTABLENETRY table.
Code:
trigger OnAction()
var
Rec_GeneralLedgerEntry: Record "G/L Entry";
Rec_ExportTableEntry: Record CFS_EXPORTTABLENETRY; // it is buffer table which has few fields
ExportExample: Codeunit CFS_ExportText;
begin
Rec_ExportTableEntry.Reset();
if Rec_ExportTableEntry.FindFirst() then begin
Rec_GeneralLedgerEntry.Reset();
Rec_GeneralLedgerEntry.SetRange("Document No.", Rec_ExportTableEntry."CFS_Document Number");
Rec_GeneralLedgerEntry.SetRange("Document Date", Rec_ExportTableEntry.CFS_DocumentDate);
Rec_GeneralLedgerEntry.SetRange("Posting Date", Rec_ExportTableEntry.CFS_PostingDate);
if Rec_GeneralLedgerEntry.FindFirst() then
ExportExample.ReCreateTextFile(Rec_GeneralLedgerEntry);
end;
Signed, Sealed and Delivered.
Don't forget to help the community by Verifying the answer and Like it if your question has been answered. It will let others know that the topic has verified answer.
Thanks & Regards,
Ankit Shah(MCT-Microsoft Certified Trainer || Dynamics 365/Business Development Manager)
Follow/Connect 101 on below
LinkedIn:- https://linkedin.com/in/dynamicpower101/
Twitter:- https://twitter.com/Dynamicpower101
Facebook:- https://facebook.com/DynamicPower101/
Telegram:- https://t.me/dynamicpower101
Medium:- https://medium.com/dynamicpower101