Rename Any Record from Text Values
Go-live cleanup week: consultants keep sending correction sheets like "depot MAIN-OLD should have been MAIN" — the new key values arrive as plain text, and the affected tables vary from sheet to sheet. Instead of writing one fix-up routine per table, you will build a single generic utility that renames whatever record it is handed, using the record's own key metadata.
Requirements
The starter ships three small sample tables — keep their fields and keys unchanged and include all files in your submission, because the grading tests seed and read them:
Depot— single-field primary key"Depot Code": Code[20], plusNameandCity."Depot Zone"— two-field primary key"Depot Code": Code[20],"Zone Code": Code[10], plusDescription."Depot Bin"— three-field primary key"Depot Code": Code[20],"Aisle No.": Integer,"Bin Code": Code[10], plusDescription.
Create a codeunit named "Record Renamer" with one public procedure:
procedure RenameByValues(var RecRef: RecordRef; NewKeyValues: List of [Text])Rules:
RecRefarrives positioned on an existing record of some table;NewKeyValuesholds the record's new primary-key values as text, in primary-key field order.- Work from the record's own key metadata — the procedure must handle any table whose primary key has one, two or three fields, not just the sample tables. Grading tests rename standard
Payment Termsand"Item Translation"records to prove it. Primary keys of more than three fields are out of scope and never tested.
Solve it with Pro
You’re reading the opening of the statement. Pro unlocks the whole problem:
- The full statement
- Starter code in the browser editor
- 12 grading tests, run on Business Central 28.5
- 3 hints
- The reference solution
Pro also opens all 92 Pro problems and lifts the daily limits on compile checks and submissions.
Already on Pro? Sign in