I Got an error message when click Preview Posting in Item Journal.
Error message:
An error occurred and the transaction is stopped. Contact your administrator or partner for further assistance.
The following AL methods are limited during write transactions because one or more tables will be locked: Form.RunModal, Codeunit.Run, Report.RunModal, XmlPort.RunModal.
Form.RunModal is not allowed in write transactions.
Codeunit.Run is allowed in write transactions only if the return value is not used. For example, 'OK := Codeunit.Run()' is not allowed.
Report.RunModal is allowed in write transactions only if 'RequestForm = false'. For example, 'Report.RunModal(...,false)' is allowed.
XmlPort.RunModal is allowed in write transactions only if 'RequestForm = false'. For example, 'XmlPort.RunModal(...,false)' is allowed.
Use the commit method to save the changes before this call, or structure the code differently.
Contact your application developer for further assistance.
AL call stack:
"Item Jnl.-Post"(CodeUnit 241).OnRunPreview line 7 - Base Application by Microsoft
"Gen. Jnl.-Post Preview"(CodeUnit 19).OnRunPreview(Event) line 2 - Base Application by Microsoft
"Gen. Jnl.-Post Preview"(CodeUnit 19).RunPreview line 4 - Base Application by Microsoft
"Gen. Jnl.-Post Preview"(CodeUnit 19).PreviewStart line 17 - Base Application by Microsoft
"Gen. Jnl.-Post Preview"(CodeUnit 19).Preview line 7 - Base Application by Microsoft
"Item Jnl.-Post"(CodeUnit 241).Preview line 6 - Base Application by Microsoft
"Item Journal"(Page 40)."PreviewPosting - OnAction"(Trigger) line 4 - Base Application by Microsoft
Has anyone encountered this issue? any Idea?
I checked Base Application app, it is up to date.
Business Central Version:
Platform Version: 24.0
Application Version: 24.5.23489.25852
Base Application Version: 24.5.23489.25852
Standard Code:
namespace Microsoft.Inventory.Posting;
using Microsoft.Finance.GeneralLedger.Journal;
using Microsoft.Finance.GeneralLedger.Preview;
using Microsoft.Inventory.Journal;
codeunit 241 "Item Jnl.-Post"
{
EventSubscriberInstance = Manual;
TableNo = "Item Journal Line";
... ...
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Gen. Jnl.-Post Preview", 'OnRunPreview', '', false, false)]
local procedure OnRunPreview(var Result: Boolean; Subscriber: Variant; RecVar: Variant)
var
ItemJournalLine: Record "Item Journal Line";
ItemJnlPost: Codeunit "Item Jnl.-Post";
begin
ItemJournalLine.Copy(RecVar);
ItemJnlPost.SetPreviewMode(true);
Result := ItemJnlPost.Run(ItemJournalLine);
end;
... ...
}