Skip to content

Commit 72f4f07

Browse files
authored
Sustainability Journal Line - Extensibility for Default Dimensions (#26438)
#### Summary This PR adds similiar methods and events as already available in other Journal Line Tables #### Work Item(s) Fixes #26273 Fixes [AB#525140](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/525140)
1 parent 1845570 commit 72f4f07

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

Apps/W1/Sustainability/app/src/Journal/SustainabilityJnlLine.Table.al

+20-5
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ table 6214 "Sustainability Jnl. Line"
7777
"Account Name" := SustainabilityAccount.Name;
7878
end;
7979

80-
GetDefaultDimensionsFromAccount();
80+
CreateDimFromDefaultDim(FieldNo("Account No."));
8181
end;
8282
}
8383
field(8; "Account Name"; Text[100])
@@ -334,15 +334,25 @@ table 6214 "Sustainability Jnl. Line"
334334
Validate("Document No.", SustainabilityJournalMgt.GetDocumentNo(IsPreviousLineValid, SustainabilityJnlBatch, PreviousLine."Document No.", "Posting Date"));
335335
end;
336336

337-
local procedure GetDefaultDimensionsFromAccount()
337+
procedure CreateDimFromDefaultDim(FieldNo: Integer)
338338
var
339339
DefaultDimSource: List of [Dictionary of [Integer, Code[20]]];
340+
begin
341+
InitDefaultDimensionSources(DefaultDimSource, FieldNo);
342+
CreateDim(DefaultDimSource);
343+
end;
344+
345+
local procedure InitDefaultDimensionSources(var DefaultDimSource: List of [Dictionary of [Integer, Code[20]]]; FieldNo: Integer)
346+
begin
347+
DimMgt.AddDimSource(DefaultDimSource, Database::"Sustainability Account", "Account No.", FieldNo = Rec.FieldNo("Account No."));
348+
OnAfterInitDefaultDimensionSources(Rec, DefaultDimSource, FieldNo);
349+
end;
350+
351+
procedure CreateDim(DefaultDimSource: List of [Dictionary of [Integer, Code[20]]])
340352
begin
341353
"Shortcut Dimension 1 Code" := '';
342354
"Shortcut Dimension 2 Code" := '';
343-
344-
DimMgt.AddDimSource(DefaultDimSource, Database::"Sustainability Account", "Account No.", true);
345-
Validate("Dimension Set ID", DimMgt.GetRecDefaultDimID(Rec, CurrFieldNo, DefaultDimSource, "Source Code", "Shortcut Dimension 1 Code", "Shortcut Dimension 2 Code", 0, 0));
355+
"Dimension Set ID" := DimMgt.GetRecDefaultDimID(Rec, CurrFieldNo, DefaultDimSource, "Source Code", "Shortcut Dimension 1 Code", "Shortcut Dimension 2 Code", 0, 0);
346356
end;
347357

348358
internal procedure ShowDimensions() IsChanged: Boolean
@@ -356,4 +366,9 @@ table 6214 "Sustainability Jnl. Line"
356366

357367
IsChanged := OldDimSetID <> "Dimension Set ID";
358368
end;
369+
370+
[IntegrationEvent(false, false)]
371+
local procedure OnAfterInitDefaultDimensionSources(var SustainabilityJnlLine: Record "Sustainability Jnl. Line"; var DefaultDimSource: List of [Dictionary of [Integer, Code[20]]]; FieldNo: Integer)
372+
begin
373+
end;
359374
}

0 commit comments

Comments
 (0)