ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] Table 36 - Sales Header - OnAfterCreateDimSetID

Open cosmo-skol opened this issue 7 years ago • 2 comments

Hello AL-Team, I need the following publisher, to be able to call additional functions after the creation of the dimension set ID:

Function CreateDim

[...]
OnAfterCreateDimTableIDs(Rec,CurrFieldNo,TableID,No);

"Shortcut Dimension 1 Code" := '';
"Shortcut Dimension 2 Code" := '';
OldDimSetID := "Dimension Set ID";
"Dimension Set ID" :=
  DimMgt.GetRecDefaultDimID(
    Rec,CurrFieldNo,TableID,No,SourceCodeSetup.Sales,"Shortcut Dimension 1 Code","Shortcut Dimension 2 Code",0,0);

// >> NEW
OnAfterCreateDimSetID(Rec,CurrFieldNo,TableID,No);
// << NEW

IF (OldDimSetID <> "Dimension Set ID") AND SalesLinesExist THEN BEGIN
  MODIFY;
  UpdateAllLineDim("Dimension Set ID",OldDimSetID);
END;

[...]

Publisher definition currently used by us IncludeSender: false GlobaVarAccess: false LOCAL [IntegrationEvent] OnAfterCreateDimSetID(VAR SalesHeader : Record "Sales Header";CallingFieldNo : Integer;VAR TableID : ARRAY [10] OF Integer;VAR No : ARRAY [10] OF Code[20])

cosmo-skol avatar Mar 11 '19 09:03 cosmo-skol

You can use existing event here in codeunit 408 DimensionManagement:

[External] GetRecDefaultDimID(RecVariant : Variant;CurrFieldNo : Integer;TableID : ARRAY [10] OF Integer;No : ARRAY [10] OF Code[20];SourceCode : Code[20];VAR GlobalDim1Code : Code[20];VAR GlobalDim2Code : Code[20];InheritFromDimSetID : Integer;Inheri OnGetRecDefaultDimID(RecVariant,CurrFieldNo,TableID,No,SourceCode,InheritFromDimSetID,InheritFromTableNo); EXIT(GetDefaultDimID(TableID,No,SourceCode,GlobalDim1Code,GlobalDim2Code,InheritFromDimSetID,InheritFromTableNo));

AlexanderYakunin avatar Mar 11 '19 14:03 AlexanderYakunin

Hello Mr. Yakunin, you are correct, this works! In combination with the parameter "InheritFromDimSetID", this is exactly what I needed. Thank you very much!

cosmo-skol avatar Mar 12 '19 06:03 cosmo-skol