Run general Journal page with a specific template and batch

Hi everyone,

I want to run page 39 (General Journal) directly with a specific Journal template and batch names that are store in a setup table.
I wrote the following piece of code in a page action:

IF xxxSetup.GET() THEN;
GenJnlLine.RESET;
GenJnlLine.SETRANGE("Journal Template Name",xxxSetup."Journal Template Name");
GenJnlLine.SETRANGE("Journal Batch Name",xxxSetup."Journal Batch Name");
pgeGenJnl.SETTABLEVIEW(GenJnlLine);
pgeGenJnl.RUNMODAL;

but it doesn’t work, I always get the list of templates when I try to run my action.
How can I correct it to get the result I want?

Thanks in advance :mrgreen:

Hi

This is probabky down to the page 39. Would always recommend saving you own version of page 39 in the 50000 range and then remove the code OnOpenPage. There is a lot there.

I have used your code above (don’t to forget to clear the page before you start) on a Nav 2009 Classic from the user set up table after adding a new field for Default Batch and after removing some of the code that was in the copy of form 39 and passing through the default batch (don’t need to as this is within the lines but not visible to the end user), the user is show a general journal for their default batch.

Hope this helps.

Neil

This is my first post and i want to say : Hi to all! [:D]

You have to use the function “TemplateSelectionFromBatch” on the Codeunit 230 GenJnlManagement

Use as parameter the General Journal Batch that you want to open.

GenJnlManagement.TemplateSelectionFromBatch(GenJnlBatch)

Greetings!

1 Like