mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-10-05 14:46:55 +01:00
Move canonical knowledge for Microsoft-owned review domains into the Microsoft layer and document the skill/knowledge co-location policy. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com> Copilot-Session: 2a6ea875-d38e-4f30-aadb-0d606f9be231
70 lines
1.8 KiB
AL
70 lines
1.8 KiB
AL
table 50120 "Source Document"
|
|
{
|
|
fields
|
|
{
|
|
field(1; "No."; Code[20])
|
|
{
|
|
DataClassification = CustomerContent;
|
|
}
|
|
}
|
|
|
|
keys
|
|
{
|
|
key(PK; "No.")
|
|
{
|
|
Clustered = true;
|
|
}
|
|
}
|
|
|
|
// "Source Key" below cannot declare a TableRelation, so the platform cannot
|
|
// repoint it. The owning table carries the relationship by hand.
|
|
trigger OnRename()
|
|
var
|
|
DocumentLink: Record "Document Link";
|
|
begin
|
|
// In OnRename, xRec holds the PREVIOUS primary key while Rec holds the new
|
|
// one — the one trigger where that is true regardless of what drove the rename.
|
|
DocumentLink.SetRange("Source Key", MakeSourceKey(xRec."No."));
|
|
if DocumentLink.FindSet(true) then
|
|
repeat
|
|
DocumentLink."Source Key" := MakeSourceKey(Rec."No.");
|
|
DocumentLink.Modify(true);
|
|
until DocumentLink.Next() = 0;
|
|
end;
|
|
|
|
local procedure MakeSourceKey(DocumentNo: Code[20]): Code[50]
|
|
begin
|
|
exit(StrSubstNo('DOC|%1', DocumentNo));
|
|
end;
|
|
}
|
|
|
|
table 50121 "Document Link"
|
|
{
|
|
fields
|
|
{
|
|
field(1; "Entry No."; Integer)
|
|
{
|
|
DataClassification = CustomerContent;
|
|
}
|
|
// Default ValidateTableRelation: the platform repoints this on rename.
|
|
field(2; "Document No."; Code[20])
|
|
{
|
|
DataClassification = CustomerContent;
|
|
TableRelation = "Source Document"."No.";
|
|
}
|
|
// Composite value — no TableRelation can express it, so the parent's
|
|
// OnRename above maintains it explicitly.
|
|
field(3; "Source Key"; Code[50])
|
|
{
|
|
DataClassification = CustomerContent;
|
|
}
|
|
}
|
|
|
|
keys
|
|
{
|
|
key(PK; "Entry No.")
|
|
{
|
|
Clustered = true;
|
|
}
|
|
}
|
|
}
|