[Event Request] Codeunit 561 "IC Data Exchange API" - Add event before inserting Buffer IC Inbox Sales Line in PostICSalesLineToICPartnerInbox
Why do you need this change?
this request should target the existing outgoing flow in codeunit 561 "IC Data Exchange API", procedure PostICSalesLineToICPartnerInbox.
The requested event is not intended to target a JsonObject serialization method directly, since this procedure currently does not expose such a sales-line JSON serialization point.
The exact target location is the following procedure:
procedure PostICSalesLineToICPartnerInbox( ICPartner: Record "IC Partner"; var TempICPartnerICInboxSalesLine: Record "IC Inbox Sales Line" temporary)
Current implementation:
var BufferICInboxSalesLine: Record "Buffer IC Inbox Sales Line"; begin if not TempICPartnerICInboxSalesLine.IsEmpty() then begin TempICPartnerICInboxSalesLine.FindSet(); repeat BufferICInboxSalesLine.TransferFields(TempICPartnerICInboxSalesLine); BufferICInboxSalesLine.Insert(); until TempICPartnerICInboxSalesLine.Next() = 0; end; end;
We would like to request an integration event after TransferFields and before BufferICInboxSalesLine.Insert().
Describe the request
Proposed event
[IntegrationEvent(false, false)] local procedure OnPostICSalesLineToICPartnerInboxOnBeforeBufferICInboxSalesLineInsert( var BufferICInboxSalesLine: Record "Buffer IC Inbox Sales Line"; TempICPartnerICInboxSalesLine: Record "IC Inbox Sales Line" temporary; ICPartner: Record "IC Partner") begin end;
Proposed implementation location
procedure PostICSalesLineToICPartnerInbox( ICPartner: Record "IC Partner"; var TempICPartnerICInboxSalesLine: Record "IC Inbox Sales Line" temporary) var BufferICInboxSalesLine: Record "Buffer IC Inbox Sales Line"; begin if not TempICPartnerICInboxSalesLine.IsEmpty() then begin TempICPartnerICInboxSalesLine.FindSet(); repeat BufferICInboxSalesLine.TransferFields(TempICPartnerICInboxSalesLine);
OnPostICSalesLineToICPartnerInboxOnBeforeBufferICInboxSalesLineInsert(
BufferICInboxSalesLine,
TempICPartnerICInboxSalesLine,
ICPartner);
BufferICInboxSalesLine.Insert();
until TempICPartnerICInboxSalesLine.Next() = 0;
end;
end;
We need to extend the standard outgoing Intercompany API flow by transporting additional line-level information together with each IC sales line.
Typical examples include:
- Item tracking information:
- Lot No.
- Serial No.
- Package No.
- Tracking quantity
- Expiration date
- Linked source document references
- Custom line-level metadata required by partner companies
In our scenario, item tracking must be propagated from the source company to the target company through the standard Intercompany API process.
The incoming flow already provides extensibility events such as:
- OnPopulateICInboxSalesLineFromJsonOnBeforeInsert
This allows custom values to be read from the incoming payload and populated into the IC Inbox Sales Line.
However, there is currently no equivalent event in the outgoing flow before the Buffer IC Inbox Sales Line is inserted.
Without this event, extensions cannot populate custom fields on the outgoing Buffer IC Inbox Sales Line in a supported way before the data is exposed through the API payload.
Internal work item: AB#642176
The extension can populate custom fields on Buffer IC Inbox Sales Line before it is inserted.
These custom fields can then be exposed through the outgoing Intercompany API payload and read on the receiving side using the existing incoming extensibility event:
OnPopulateICInboxSalesLineFromJsonOnBeforeInsert
This request only adds one integration event in procedure PostICSalesLineToICPartnerInbox, after TransferFields and before BufferICInboxSalesLine.Insert.
No change in standard business logic is required.
Hi @cponcet-pdw,
Thank you for your extensibility request. To help us process it efficiently, please update the issue to include the required information.
Missing Information:
- Justification for event inside loop: Please explain why the event must fire on each iteration of the
FindSet()/repeat..untilloop inPostICSalesLineToICPartnerInbox, and why a before-loop or after-loop event would not satisfy your scenario.
Please update the issue with the missing details. We'll automatically re-analyze once updated.
[!NOTE] Automatically generated by the Triage Agent — advisory only. An engineer will review before any action is taken.
[!TIP] Not accurate? Reply with
/not-accurate(optional: add a short explanation). Your feedback improves future responses.
The event must be raised inside the FindSet() / repeat..until loop because the customization scenario is line-specific.
Each record in TempICPartnerICInboxSalesLine may contain different business information that needs to be propagated independently to the corresponding Buffer IC Inbox Sales Line record.
Typical examples include:
- Item tracking information (lot numbers, serial numbers, package numbers)
- Linked source purchase document references
- Linked source purchase line references
- Custom line-level metadata
- External identifiers
These values are different for each sales line and must be copied individually to the matching buffer record before insertion.
A before-loop event would not be sufficient because:
- The Buffer IC Inbox Sales Line record does not yet exist.
- There is no access to the current line being processed.
- It would not be possible to populate different values per line.
An after-loop event would not be sufficient because:
- The Buffer IC Inbox Sales Line record has already been inserted.
- Extensions would need to re-read and modify inserted buffer records.
- This introduces additional database operations and complexity.
- It is not suitable for scenarios where values must be populated before the standard process continues.
The requested event follows the same extensibility pattern already used elsewhere in the application where record-specific customization is required before insertion.
The purpose is to allow extensions to enrich each Buffer IC Inbox Sales Line individually after TransferFields() and before Insert(), while preserving the standard process.
✅ Analysis complete - ready for further processing
Implementation:
Add a new integration event in PostICSalesLineToICPartnerInbox after BufferICInboxSalesLine.TransferFields(TempICPartnerICInboxSalesLine); and before BufferICInboxSalesLine.Insert();.
Location in PostICSalesLineToICPartnerInbox procedure:
if not TempICPartnerICInboxSalesLine.IsEmpty() then begin
TempICPartnerICInboxSalesLine.FindSet();
repeat
BufferICInboxSalesLine.TransferFields(TempICPartnerICInboxSalesLine);
OnPostICSalesLineToICPartnerInboxOnBeforeBufferICInboxSalesLineInsert(BufferICInboxSalesLine, TempICPartnerICInboxSalesLine, ICPartner);
BufferICInboxSalesLine.Insert();
until TempICPartnerICInboxSalesLine.Next() = 0;
end;
Event Publisher (add at the end of the codeunit with other events):
[IntegrationEvent(false, false)]
local procedure OnPostICSalesLineToICPartnerInboxOnBeforeBufferICInboxSalesLineInsert(var BufferICInboxSalesLine: Record "Buffer IC Inbox Sales Line"; TempICPartnerICInboxSalesLine: Record "IC Inbox Sales Line" temporary; ICPartner: Record "IC Partner")
begin
end;
File: ICDataExchangeAPI.Codeunit.al
[!NOTE] Automatically generated by the Triage Agent — advisory only. An engineer will review before any action is taken.
[!TIP] Not accurate? Reply with
/not-accurate(optional: add a short explanation). Your feedback improves future responses.
Fixed