Skip to content

Commit

Permalink
Sustainability Journal Line - Extensibility for Default Dimensions (#…
Browse files Browse the repository at this point in the history
…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)
  • Loading branch information
pri-kise authored May 24, 2024
1 parent 1845570 commit 72f4f07
Showing 1 changed file with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ table 6214 "Sustainability Jnl. Line"
"Account Name" := SustainabilityAccount.Name;
end;

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

local procedure GetDefaultDimensionsFromAccount()
procedure CreateDimFromDefaultDim(FieldNo: Integer)
var
DefaultDimSource: List of [Dictionary of [Integer, Code[20]]];
begin
InitDefaultDimensionSources(DefaultDimSource, FieldNo);
CreateDim(DefaultDimSource);
end;

local procedure InitDefaultDimensionSources(var DefaultDimSource: List of [Dictionary of [Integer, Code[20]]]; FieldNo: Integer)
begin
DimMgt.AddDimSource(DefaultDimSource, Database::"Sustainability Account", "Account No.", FieldNo = Rec.FieldNo("Account No."));
OnAfterInitDefaultDimensionSources(Rec, DefaultDimSource, FieldNo);
end;

procedure CreateDim(DefaultDimSource: List of [Dictionary of [Integer, Code[20]]])
begin
"Shortcut Dimension 1 Code" := '';
"Shortcut Dimension 2 Code" := '';

DimMgt.AddDimSource(DefaultDimSource, Database::"Sustainability Account", "Account No.", true);
Validate("Dimension Set ID", DimMgt.GetRecDefaultDimID(Rec, CurrFieldNo, DefaultDimSource, "Source Code", "Shortcut Dimension 1 Code", "Shortcut Dimension 2 Code", 0, 0));
"Dimension Set ID" := DimMgt.GetRecDefaultDimID(Rec, CurrFieldNo, DefaultDimSource, "Source Code", "Shortcut Dimension 1 Code", "Shortcut Dimension 2 Code", 0, 0);
end;

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

IsChanged := OldDimSetID <> "Dimension Set ID";
end;

[IntegrationEvent(false, false)]
local procedure OnAfterInitDefaultDimensionSources(var SustainabilityJnlLine: Record "Sustainability Jnl. Line"; var DefaultDimSource: List of [Dictionary of [Integer, Code[20]]]; FieldNo: Integer)
begin
end;
}

0 comments on commit 72f4f07

Please sign in to comment.