{"title":"Record.SetLoadFields([Any,...]) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/record/record-setloadfields-method/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/record/record-setloadfields-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/record/record-setloadfields-method","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Sets the fields to be initially loaded when the record is retrieved from its data source.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"Record.SetLoadFields([Any,...]) Method","slug":"recordsetloadfieldsany-method","at":0,"chars":2681},{"level":2,"title":"Syntax","slug":"syntax","at":256,"chars":70},{"level":2,"title":"Parameters","slug":"parameters","at":326,"chars":180},{"level":2,"title":"Return Value","slug":"return-value","at":506,"chars":255},{"level":2,"title":"Remarks","slug":"remarks","at":761,"chars":1068},{"level":2,"title":"Example","slug":"example","at":1829,"chars":666},{"level":2,"title":"Related information","slug":"related-information","at":2495,"chars":186}],"text":"# Record.SetLoadFields([Any,...]) Method\n> Version: _Available or changed with runtime version 6.0._\nSets the fields to be initially loaded when the record is retrieved from its data source. This will overwrite fields previously selected for initial load.\n## Syntax\n```al\n[Ok := ]  Record.SetLoadFields([Fields: Any,...])\n```\n## Parameters\nRecord\nType: record-data-type\nAn instance of the record-data-type data type.\n*[Optional] Fields*\nType: ../any/any-data-type\nThe FieldNo's of the fields to be loaded.\n## Return Value\n*[Optional] Ok*\nType: ../boolean/boolean-data-type\ntrue if all fields are selected for subsequent loads; otherwise, false. If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.\n## Remarks\nCalling SetLoadFields on a record without passing any fields will reset the fields selected to load to the default, where all readable normal fields are selected for load.\nIt is not necessary to include the following fields, because they are always selected for loading: Primary key, SystemId, and data audit fields (SystemCreatedAt, SystemCreatedBy, SystemModifiedAt, SystemModifiedBy).\nDepending on the runtime version, the runtime may require extra fields to be selected for loading. Which extra fields to specify depends on the state of the record and table or table extension definition. For example, fields that are filtered upon are always loaded.\n> NOTE\n> Only fields of `FieldClass = Normal` are supported as input values for the Fields parameter. If fields of `FieldClass = FlowFilter` or `FieldClass = FlowField` are passed, the return value will be false if observed; otherwise, a runtime error will occur.\nThis method is part of the partial records capability for improving performance. See Using partial records<../../devenv-partial-records>.\n## Example\nThis example uses the SetLoadFields method to speedup the calculation of the mean for values of the Standard Cost field in the Item table. Instead of loading all fields, only the Standard Cost is loaded. The other fields aren't needed for the calculation, so they're not loaded.\n```al\nprocedure ComputeArithmeticMean(): Decimal\nvar\n    Item: Record Item;\n    SumTotal: Decimal;\n    Counter: Integer;\nbegin\n    Item.SetLoadFields(Item.\"Standard Cost\");\n    if Item.FindSet() then begin\n        repeat\n            SumTotal += Item.\"Standard Cost\";\n            Counter += 1;\n        until Item.Next() = 0;\n        exit(SumTotal / Counter);\n    end;\nend;\n```\n## Related information\nUsing Partial Records<../../devenv-partial-records>\nrecord-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}