AL interface implementation question

txeriff
txeriff Member Posts: 517

I'm new with interfaces, I'm trying to replace this event:

  [EventSubscriber(ObjectType::Codeunit, Codeunit::"Sales-Post", OnBeforePostInvPostBuffer, '', false, false)]   

local procedure OnBeforePostInvPostBuffer(var GenJnlLine: Record "Gen. Journal Line"; var InvoicePostBuffer: Record "Invoice Post. Buffer"; var SalesHeader: Record "Sales Header"; CommitIsSuppressed: Boolean; var GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line"; PreviewMode: Boolean)   

begin       

GenJnlLine.Myfield := SalesHeader.Myfield;   

end;

In CU80 I thought I could use one of these ifaces:

InvoicePostingInterface.PostLines(SalesHeader, GenJnlPostLine, Window, TotalAmount);

InvoicePostingInterface.PostLedgerEntry(SalesHeader, GenJnlPostLine);

I implemented an interface for it but however GenJnlPostLine is a codeunit, not the journal line and I can't pass salesheader.MyField back to it.

Any ideas? should I just consider using another event or reimplement it?
thanks