Can you please add event OnBeforeOutboxJnlLineToInbox in procedure OutboxJnlLineToInbox
Event Publisher would be:
[IntegrationEvent(false, false)]
local procedure OnBeforeOutboxJnlLineToInbox(var ICInboxTrans: Record "IC Inbox Transaction"; var ICOutboxJnlLine: Record "IC Outbox Jnl. Line"; var ICInboxJnlLine: Record "IC Inbox Jnl. Line"; var ICPartner: Record "IC Partner"; var IsHandled: Boolean)
begin
end;
The procedure would look like:
procedure OutboxJnlLineToInbox(var ICInboxTrans: Record "IC Inbox Transaction"; var ICOutboxJnlLine: Record "IC Outbox Jnl. Line"; var ICInboxJnlLine: Record "IC Inbox Jnl. Line")
var
ICSetup: Record "IC Setup";
LocalICPartner: Record "IC Partner";
TempPartnerICPartner: Record "IC Partner" temporary;
FeatureTelemetry: Codeunit "Feature Telemetry";
ICMapping: Codeunit "IC Mapping";
ICDataExchange: Interface "IC Data Exchange";
IsHandled: Boolean;
begin
FeatureTelemetry.LogUptake('0000IJM', ICMapping.GetFeatureTelemetryName(), Enum::"Feature Uptake Status"::Used);
FeatureTelemetry.LogUsage('0000IKD', ICMapping.GetFeatureTelemetryName(), 'Outbox Journal Line to Inbox');
IsHandled := false;
OnBeforeOutboxJnlLineToInbox(ICInboxTrans, ICOutboxJnlLine, ICInboxJnlLine, LocalICPartner, IsHandled);
if IsHandled then
exit;
GetGLSetup();
ICSetup.Get();
ICInboxJnlLine."Transaction No." := ICInboxTrans."Transaction No.";
ICInboxJnlLine."IC Partner Code" := ICInboxTrans."IC Partner Code";
ICInboxJnlLine."Transaction Source" := ICInboxTrans."Transaction Source";
ICInboxJnlLine."Line No." := ICOutboxJnlLine."Line No.";
if ICOutboxJnlLine."IC Partner Code" = ICSetup."IC Partner Code" then begin
LocalICPartner.Get(ICInboxTrans."IC Partner Code");
TempPartnerICPartner := LocalICPartner;
end
else begin
LocalICPartner.Get(ICOutboxJnlLine."IC Partner Code");
LocalICPartner.TestField("Inbox Type", LocalICPartner."Inbox Type"::Database);
ICDataExchange := LocalICPartner."Data Exchange Type";
ICDataExchange.GetICPartnerFromICPartner(LocalICPartner, ICInboxJnlLine."IC Partner Code", TempPartnerICPartner);
end;
case ICOutboxJnlLine."Account Type" of
ICOutboxJnlLine."Account Type"::"G/L Account":
begin
ICInboxJnlLine."Account Type" := ICInboxJnlLine."Account Type"::"G/L Account";
ICInboxJnlLine."Account No." := ICOutboxJnlLine."Account No.";
end;
ICOutboxJnlLine."Account Type"::Vendor:
begin
ICInboxJnlLine."Account Type" := ICInboxJnlLine."Account Type"::Customer;
TempPartnerICPartner.TestField("Customer No.");
ICInboxJnlLine."Account No." := TempPartnerICPartner."Customer No.";
end;
ICOutboxJnlLine."Account Type"::Customer:
begin
ICInboxJnlLine."Account Type" := ICInboxJnlLine."Account Type"::Vendor;
TempPartnerICPartner.TestField("Vendor No.");
ICInboxJnlLine."Account No." := TempPartnerICPartner."Vendor No.";
end;
ICOutboxJnlLine."Account Type"::"IC Partner":
begin
ICInboxJnlLine."Account Type" := ICInboxJnlLine."Account Type"::"IC Partner";
ICInboxJnlLine."Account No." := ICInboxJnlLine."IC Partner Code";
end;
ICOutboxJnlLine."Account Type"::"Bank Account":
begin
ICInboxJnlLine."Account Type" := ICInboxJnlLine."Account Type"::"Bank Account";
ICInboxJnlLine."Account No." := ICOutboxJnlLine."Account No.";
end;
end;
ICInboxJnlLine.Amount := -ICOutboxJnlLine.Amount;
ICInboxJnlLine.Description := ICOutboxJnlLine.Description;
ICInboxJnlLine."VAT Amount" := -ICOutboxJnlLine."VAT Amount";
if ICOutboxJnlLine."Currency Code" = GLSetup."LCY Code" then
ICInboxJnlLine."Currency Code" := ''
else
ICInboxJnlLine."Currency Code" := ICOutboxJnlLine."Currency Code";
ICInboxJnlLine."Due Date" := ICOutboxJnlLine."Due Date";
ICInboxJnlLine."Payment Discount %" := ICOutboxJnlLine."Payment Discount %";
ICInboxJnlLine."Payment Discount Date" := ICOutboxJnlLine."Payment Discount Date";
ICInboxJnlLine.Quantity := -ICOutboxJnlLine.Quantity;
ICInboxJnlLine."Document No." := ICOutboxJnlLine."Document No.";
OnOutboxJnlLineToInboxOnBeforeICInboxJnlLineInsert(ICInboxJnlLine, ICOutboxJnlLine);
ICInboxJnlLine.Insert();
end;
}
Additional context
We would like to have this new event subscriber so we can populate some new fields. Some of the functions in the same codeunit have this kind of event we also subscribe to do our code. At the end of the code, the existing event is not enough because it doesn't have all the necessary records.
Internal work item: AB#542669
Describe the request
Can you please add event OnBeforeOutboxJnlLineToInbox in procedure OutboxJnlLineToInbox
Event Publisher would be:
The procedure would look like:
}
Additional context
We would like to have this new event subscriber so we can populate some new fields. Some of the functions in the same codeunit have this kind of event we also subscribe to do our code. At the end of the code, the existing event is not enough because it doesn't have all the necessary records. Internal work item: AB#542669