Open General Journal Page with Batch Paramater

jimmyfjimmyf Member Posts: 104
edited 2013-08-20 in Navision Financials
In Nav 2013 I would like to open Page 39, General Journal from a page action by passing the Batch Name as a paramater.

Does anyone have any experience doing this?

Comments

  • skullaskulla Member Posts: 140
    You can add a new function in Page 39 to set batch name to CurrentJnlBatchName and call that function before calling the page.
  • jglathejglathe Member Posts: 639
    Hi,

    this should go without an extra function. In Page 39, trigger OnOpenPage is this standard code:
    BalAccName := '';
    OpenedFromBatch := ("Journal Batch Name" <> '') AND ("Journal Template Name" = '');
    IF OpenedFromBatch THEN BEGIN
      CurrentJnlBatchName := "Journal Batch Name";
      GenJnlManagement.OpenJnl(CurrentJnlBatchName,Rec);
      EXIT;
    END;
    GenJnlManagement.TemplateSelection(PAGE::"General Journal",0,FALSE,Rec,JnlSelected);
    IF NOT JnlSelected THEN
      ERROR('');
    GenJnlManagement.OpenJnl(CurrentJnlBatchName,Rec);
    

    When you set the gen. jnl. batch name (and only this field) in the Gen. Jnl Line record before calling the page with it, then it should work. I would define the Gen. Jnl. Line as a local variable on the page action, though.

    with best regards

    Jens
  • navuser1navuser1 Member Posts: 1,329
    edited 2018-05-08
    Dear All,

    I want to open a custom page (similar to page id 39) thru a specific "Journal Template Name" & a "Journal Batch Name" too.

    Please look the Code of OnOpen Page (Custom Page)...
    OnOpenPage()
    BalAccName := '';
    IF IsOpenedFromBatch THEN BEGIN
      CurrentJnlBatchName := "Journal Batch Name";
      GenJnlManagement.OpenJnl(CurrentJnlBatchName,Rec);
      SetControlAppearance;
      EXIT;
    END;
    GenJnlManagement.TemplateSelection(PAGE::"General Journal",0,FALSE,Rec,JnlSelected);
    IF NOT JnlSelected THEN
      ERROR('');
    GenJnlManagement.OpenJnl(CurrentJnlBatchName,Rec);
    SetControlAppearance;
    

    Due to above function called "IsOpenedFromBatch" in the SourceTable 81, I am not able to execute the same.

    The Code of "IsOpenedFromBatch" is given below.
    IsOpenedFromBatch() : Boolean
    BatchFilter := GETFILTER("Journal Batch Name");
    IF BatchFilter <> '' THEN BEGIN
      TemplateFilter := GETFILTER("Journal Template Name");
      IF TemplateFilter <> '' THEN
        GenJournalBatch.SETFILTER("Journal Template Name",TemplateFilter);
      GenJournalBatch.SETFILTER(Name,BatchFilter);
      GenJournalBatch.FINDFIRST;
    END;
    
    EXIT((("Journal Batch Name" <> '') AND ("Journal Template Name" = '')) OR (BatchFilter <> ''));
    

    I have tried to achieve my goal thru different ways but I can't get the positive result.

    Please suggest the best solution for the same without hampering standard code/code blocking..

    Thanks,
    Navuser1
    Now or Never
Sign In or Register to comment.