From aefd2fbe5d8f2b972629fc4b5750da89cce116af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Kapit=C3=A1n?= Date: Sat, 13 Mar 2021 14:55:42 +0100 Subject: [PATCH] Fix of assigning field/value ID (Err: Record #ObjectID, #FieldID already exists) --- App/Src/AssignableRanges/AssignableRangeHeader.Table.al | 3 ++- App/Src/Extensions/API/ExtensionObjectLAPI.Page.al | 4 ++++ App/Src/Extensions/ExtensionObjectLine.Table.al | 9 +++++++-- App/Src/Extensions/ExtensionObjectLines.Page.al | 5 +++++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/App/Src/AssignableRanges/AssignableRangeHeader.Table.al b/App/Src/AssignableRanges/AssignableRangeHeader.Table.al index ed3ef58..d1ce753 100644 --- a/App/Src/AssignableRanges/AssignableRangeHeader.Table.al +++ b/App/Src/AssignableRanges/AssignableRangeHeader.Table.al @@ -357,7 +357,8 @@ table 80001 "C4BC Assignable Range Header" if Rec."Ranges per BC Instance" and (ForBusinessCentralInstance = '') then Error(MissingParameterErr, Rec.FieldCaption("Ranges per BC Instance")); - C4BCExtensionObjectLine.SetCurrentKey("Object Type", "Object ID"); + C4BCExtensionObjectLine.SetCurrentKey("Object Type", "ID"); + C4BCExtensionObjectLine.SetAscending("ID", true); C4BCExtensionObjectLine.SetRange("Object Type", ForObjectType); C4BCExtensionObjectLine.SetRange("Assignable Range Code", Rec."Code"); if Rec."Ranges per BC Instance" then begin diff --git a/App/Src/Extensions/API/ExtensionObjectLAPI.Page.al b/App/Src/Extensions/API/ExtensionObjectLAPI.Page.al index dc47006..2ce9f15 100644 --- a/App/Src/Extensions/API/ExtensionObjectLAPI.Page.al +++ b/App/Src/Extensions/API/ExtensionObjectLAPI.Page.al @@ -40,6 +40,10 @@ page 80012 "C4BC Extension Object L. API" { ApplicationArea = All; } + field(name; Rec.Name) + { + ApplicationArea = All; + } field(systemCreatedAt; Rec.SystemCreatedAt) { ApplicationArea = All; diff --git a/App/Src/Extensions/ExtensionObjectLine.Table.al b/App/Src/Extensions/ExtensionObjectLine.Table.al index 8a13fff..599202f 100644 --- a/App/Src/Extensions/ExtensionObjectLine.Table.al +++ b/App/Src/Extensions/ExtensionObjectLine.Table.al @@ -29,10 +29,14 @@ table 80006 "C4BC Extension Object Line" field(5; ID; Integer) { Caption = 'ID'; - Editable = false; DataClassification = CustomerContent; } - field(6; "Created By"; Text[50]) + field(6; Name; Text[30]) + { + Caption = 'Name'; + DataClassification = CustomerContent; + } + field(7; "Created By"; Text[50]) { Caption = 'Created By'; DataClassification = SystemMetadata; @@ -65,6 +69,7 @@ table 80006 "C4BC Extension Object Line" { Clustered = true; } + key(Fields; "Object Type", "ID") { } } trigger OnInsert() diff --git a/App/Src/Extensions/ExtensionObjectLines.Page.al b/App/Src/Extensions/ExtensionObjectLines.Page.al index 6fd1e9c..3bee0c4 100644 --- a/App/Src/Extensions/ExtensionObjectLines.Page.al +++ b/App/Src/Extensions/ExtensionObjectLines.Page.al @@ -20,6 +20,11 @@ page 80010 "C4BC Extension Object Lines" ApplicationArea = All; ToolTip = 'ID of the field or the enum value'; } + field(Name; Rec.Name) + { + ToolTip = 'Specifies name of the field. The evidence of field names is optional.'; + ApplicationArea = All; + } field("Created By"; Rec."Created By") { ApplicationArea = All;