How to Skip Confirmation Message for Posting in Item Journal?

julkifli33julkifli33 Member Posts: 1,092
hi All,
I have created new module.
after insert Item Journal Line, i want to immediately post it.
how do i skip this confirmation message?
atb6rnt7u47y.png

my code :
ItemJournalLine.Insert;
CODEUNIT.RUN(CODEUNIT::"Item Jnl.-Post", ItemJournalLine);

Answers

  • bbrownbbrown Member Posts: 3,268
    Post directly thru codeunit 22 "Item Jnl.-Post Line". But be careful you don't require any functionality handled by the related precalled codeunits. Such as related warehouse journal handling
    There are no bugs - only undocumented features.
  • PurpleHazePurpleHaze Member Posts: 42
    Can`t you subscribe to OnBeforeCode(ItemJnlLine, HideDialog, SuppressCommit, IsHandled); in codeunit "Item Jnl.-Post" and set HideDialog to true?
  • txerifftxeriff Member Posts: 500
    The piece of code seems to be located in CU231 Text001.

    I dont know how you can skip it in business central without changing base app code, there is no hidedialog for this function in my nav version at least.

    In classic nav is quite simple but not in BC.
  • PurpleHazePurpleHaze Member Posts: 42
    This is how it looks like in BC18 (OnBeforeCode is available with HideDialog):
    codeunit 241 "Item Jnl.-Post"
    {
        TableNo = "Item Journal Line";
    
        trigger OnRun()
        begin
            ItemJnlLine.Copy(Rec);
            Code;
            Copy(ItemJnlLine);
        end;
    
        var
            Text000: Label 'cannot be filtered when posting recurring journals';
            Text001: Label 'Do you want to post the journal lines?';
            Text002: Label 'There is nothing to post.';
            Text003: Label 'The journal lines were successfully posted.';
            Text004: Label 'The journal lines were successfully posted. ';
            Text005: Label 'You are now in the %1 journal.';
            ItemJnlTemplate: Record "Item Journal Template";
            ItemJnlLine: Record "Item Journal Line";
            TempJnlBatchName: Code[10];
    
        local procedure "Code"()
        var
            ItemJnlPostBatch: Codeunit "Item Jnl.-Post Batch";
            HideDialog: Boolean;
            SuppressCommit: Boolean;
            IsHandled: Boolean;
        begin
            HideDialog := false;
            SuppressCommit := false;
            IsHandled := false;
            OnBeforeCode(ItemJnlLine, HideDialog, SuppressCommit, IsHandled);
            if IsHandled then
                exit;
    
            with ItemJnlLine do begin
    
  • julkifli33julkifli33 Member Posts: 1,092
    ok thanks for all the suggestion.
    by the way i am using cloud bc, so its not possible to change the standard code.
    i will try to use OnBeforeCode

    Thanks.
Sign In or Register to comment.