{"title":"Report.RunRequestPage(Integer [, Text]) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/report/report-runrequestpage-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-runrequestpage-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-runrequestpage-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":"Runs the request page for a report without running the report.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"Report.RunRequestPage(Integer [, Text]) Method","slug":"reportrunrequestpageinteger-text-method","at":0,"chars":4921},{"level":2,"title":"Syntax","slug":"syntax","at":274,"chars":96},{"level":2,"title":"Parameters","slug":"parameters","at":370,"chars":320},{"level":2,"title":"Return Value","slug":"return-value","at":690,"chars":146},{"level":2,"title":"Remarks","slug":"remarks","at":836,"chars":713},{"level":2,"title":"Example: Using `Report::<object ID>` syntax","slug":"example-using-reportobject-id-syntax","at":1549,"chars":521},{"level":2,"title":"Example: End-to-end scenario","slug":"example-end-to-end-scenario","at":2070,"chars":2717},{"level":2,"title":"Related information","slug":"related-information","at":4787,"chars":134}],"text":"# Report.RunRequestPage(Integer [, Text]) Method\n> Version: _Available or changed with runtime version 1.0._\nRuns the request page for a report without running the report. Returns an XML string that contains the request page parameters that are entered on the request page.\n## Syntax\n```al\nParameters :=   Report.RunRequestPage(Number: Integer [, Parameters: Text])\n```\n## Parameters\nNumber\nType: ../integer/integer-data-type\nThe ID of the report for which you want to run the request page. If the report that you specify does not exist, then a run-time error occurs.\n*[Optional] Parameters*\nType: ../text/text-data-type\nA string of request page parameters as XML to use to run the report.\n## Return Value\nParameters\nType: ../text/text-data-type\nXML string that contains the request page parameters that are entered on the request page\n## Remarks\nThis method opens the request page for the specified report to allow the user to provide parameters for the report. When the user closes the request page by choosing the OK button, a string that contains the parameter values that were set by the user is returned. When the user chooses the Cancel button, an empty string is returned. The returned parameter string can be picked up by calling one of the following methods:\n report-execute-method\n report-print-method\n report-saveas-method\n> NOTE\n> You can use these methods to schedule reports in the job queue.\nBecause the request page runs in the context of where it was invoked from, users can't bookmark a link to this page from the user interface.\n## Example: Using `Report::<object ID>` syntax\nAs mentioned previously, the Report.RunRequestPage method throws a runtime error if no report with the supplied object ID exists. If you know the report object, a safe way to call Report.RunRequestPage is to use the `Report::<object identifier>` syntax because the compiler will tell you if the report object doesn't exist.\n```al\nprocedure RunRequestPageKnownReport()\nvar\n    XmlParameters: Text;\nbegin\n    XmlParameters := Report.RunRequestPage(Report::MyReport);\nend;\n```\n## Example: End-to-end scenario\nThis example illustrates how to use the RunRequestPage method to run the request page for report ID 206 Sales Invoice. The request page parameters are saved to a table. The parameters are then used with the Execute, SaveAs, and Print methods to preview the report, save it as a PDF file, and print it.\nThis example requires that you create a table for holding parameters that are entered on the report request page and a codeunit that runs the report methods.\nCreate a table called ReportParameters that has the following fields.\n```al\ntable 50103 ReportParameters\n{\n    DataClassification = ToBeClassified;\n\n    fields\n    {\n        field(1; ReportId; Integer)\n        {\n            DataClassification = ToBeClassified;\n\n        }\n        field(2; UserId; Code[100])\n        {\n            DataClassification = ToBeClassified;\n        }\n        field(3; Parameters; Blob)\n        {\n            DataClassification = ToBeClassified;\n        }\n    }\n}\n```\nCreate a codeunit and add the following code to the OnRun trigger of the codeunit.\n```al\nvar\n    ReportParameters: Record ReportParameters;\n    XmlParameters: Text;\n    OStream: OutStream;\n    IStream: InStream;\n    CurrentUser: Code[100];\n    Content: File;\n    TempFileName: Text;\nbegin\n    // Use the Report.RunRequestPage method to run the request page to get report parameters\n    XmlParameters := Report.RunRequestPage(Report::\"Sales Invoice\");\n    CurrentUser := UserId;\n\n    // Save the request page parameters to the database table\n    with ReportParameters do begin\n        // Cleanup\n        if Get(206,CurrentUser) then\n        Delete;\n\n        SetAutoCalcFields(Parameters);\n        ReportId := 206;\n        UserId := CurrentUser;\n        Parameters.CreateOutStream(OStream,TextEncoding::UTF8);\n        Message(XmlParameters);\n        OStream.WriteText(XmlParameters);\n\n        Insert;\n    end;\n\n    Clear(ReportParameters);\n    XmlParameters := '';\n\n    // Read the request page parameters from the database table\n    with ReportParameters do begin\n        SetAutoCalcFields(Parameters);\n        Get(206,CurrentUser);\n        Parameters.CreateInStream(IStream,TextEncoding::UTF8);\n        IStream.ReadText(XmlParameters);\n    end;\n\n    // Use the Report.SaveAs method to save the report as a PDF file\n    Content.Create('TestFile.pdf');\n    Content.CreateOutStream(OStream);\n    Report.SaveAs(Report::\"Sales Invoice\", XmlParameters,ReportFormat::Pdf,OStream);\n    Content.Close;\n\n    // Use the Report.Execute method to preview the report\n    Report.Execute(Report::\"Sales Invoice\", XmlParameters);\n\n    // Use the Report.Print method to print the report\n    Report.Print(Report::\"Sales Invoice\", XmlParameters);\n\n```\n## Related information\nreport-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}