I want to open General Journal form with Journal Template Name and Journal Batch Name already selected (filtered by).
Variables:
recGenJournalLine = Record: Gen. Journal Line
frmGeneralJournal = Form: General Journal
cuGenJnlManagement = Codeunit: GenJnlManagement
I insert records in Gen. Journal Line table through code.
After all records are inserted and transaction commited I'm trying to open the form General Journal:
First I set filter on recGenJournalLine:
recGenJournalLine.SETRANGE("Journal Template Name", codJTemplate);
recGenJournalLine.SETRANGE("Journal Batch Name", codJBatch);
Then I tried this (didn't work):
FORM.RUN(39, recGenJournalLine);
Then this (didn't work):
frmGeneralJournal.SETTABLEVIEW(recGenJournalLine);
frmGeneralJournal.SETRECORD(recGenJournalLine);
frmGeneralJournal.RUN;
I eider get error (something like "Can't set (DEFAULT)&(DEFAULT) as a filter for Journal Template Name") or form opens with some other batch selected. ](*,)
Then I found out that General Journal form sets those filters in OnOpenForm trigger.
Does this mean that whatever I select as a filter doesn't have any effect? :shock:
I repeat: Is there any way to open specific template and batch in General Journal form through code?
Thanks!
Comments
create a new function in the form to set the filter you require
eg
so you would do the following in your form
GenJnlForm.SetCalledFilter(Genjnl);
GenJnlForm.Run;
Thanks anyway!