Thanks,
I'm able to set the DateCheckDone to true
it's working the error
"The Posting Date is not within your range of allowed posting dates."
is no longer raised
but I'm still receiving another error now:
"Posting Date is not within your range of allowed posting dates in Gen. Journal Line Journal Template Name='',Journal Batch Name='',Line No.='0'"
How can I find which procedure is generating the error?
Maybe I have to listen for another event?
and what is even stranger, I'm using a template name and batch name when I prepare my journal in my code.
so the error did not point my names:
Template Name='',Journal Batch Name='',
to confirm that I have the batch name in place in my event subscriber procedure I test that:
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Item Jnl.-Check Line", 'OnBeforeDateNotAllowed', '', true, true)]
local procedure HandleOnBeforeDateNowAllowed(ItemJnlLine: Record "Item Journal Line"; var DateCheckDone: Boolean)
var
InventoryPeriod: Record "Inventory Period";
begin
DateCheckDone := true;
Error(ItemJnlLine."Journal Batch Name"); <-- added for testing removed after
end;
so I raise an error with the Journal Batch Name, and I see the name I putted in my code, not an empty one.