{"title":"Report.DefaultLayout(Integer) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/report/report-defaultlayout-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/report/report-defaultlayout-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/report/report-defaultlayout-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":"Gets the default built-in layout type that is used on a specified report.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"Report.DefaultLayout(Integer) Method","slug":"reportdefaultlayoutinteger-method","at":0,"chars":2551},{"level":2,"title":"Syntax","slug":"syntax","at":392,"chars":77},{"level":2,"title":"Parameters","slug":"parameters","at":469,"chars":177},{"level":2,"title":"Return Value","slug":"return-value","at":646,"chars":143},{"level":2,"title":"Remarks","slug":"remarks","at":789,"chars":120},{"level":2,"title":"Example (using `Report::<object identifier>` syntax)","slug":"example-using-reportobject-identifier-syntax","at":909,"chars":616},{"level":2,"title":"Example (using a Try function)","slug":"example-using-a-try-function","at":1525,"chars":892},{"level":2,"title":"Related information","slug":"related-information","at":2417,"chars":134}],"text":"# Report.DefaultLayout(Integer) Method\n> Version: _Available or changed with runtime version 1.0 until version 14.0 where it was deprecated for the following reason: \"Replace with layout selection and 'Report Layout List' lookup. See https://go.microsoft.com/fwlink/?linkid=2284102&clcid=0x409 for more information.\"_\nGets the default built-in layout type that is used on a specified report.\n## Syntax\n```al\nDefaultLayout :=   Report.DefaultLayout(Number: Integer)\n```\n## Parameters\nNumber\nType: ../integer/integer-data-type\nThe ID of the report that you want to save. If the report that you specify does not exist, then a run-time error occurs.\n## Return Value\nDefaultLayout\nType: ../defaultlayout/defaultlayout-option\nThe default built-in layout type that is used on a specified report.\n## Remarks\nThe default layout for a report is specified by the report's ../../properties/devenv-defaultlayout-property.\n## Example (using `Report::<object identifier>` syntax)\nAs mentioned above, the Report.DefaultLayout method will throw a run-time error if no report with the supplied object ID exists. If you know the report object, a safe way to call Report.DefaultLayout is to use the `Report::<object identifier>` syntax as the compiler will tell you if Report1 doesn't exist.\n```al\nprocedure MyProcKnownReport()\nvar\n    layout: DefaultLayout;\nbegin\n    // When you know the report object, this is safe\n    // as the compiler will tell you if MyReport does not exist\n    layout := Report.DefaultLayout(Report::MyReport);\nend;\n```\n## Example (using a Try function)\nAs mentioned above, the Report.DefaultLayout method will throw a run-time error if no report with the supplied object ID exists. If you don't know the report object in your AL code, then you can wrap the Report.DefaultLayout method in a Try function as it doesn't write to the database.\n```al\nprocedure GetLayout(ObjectId: Integer): DefaultLayout\nvar\n    layout: DefaultLayout;\nbegin\n    if not TryReportDefaultLayout(ObjectId) then begin\n        // handle error here\n    end\n    else // now it's safe to call Report.DefaultLayout\n        layout := Report.DefaultLayout(ObjectId);\n\n    exit(layout);\nend;\n\n[TryFunction]\n// Safe to wrap Report.DefaultLayout in a Try function\n// as it doesn't write to the database\nprocedure TryReportDefaultLayout(ObjectId: Integer)\nvar\n    layout: DefaultLayout;\nbegin\n    layout := Report.DefaultLayout(ObjectId);\nend;\n```\n## Related information\nreport-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}