{"title":"Page.SetBackgroundTaskResult(Dictionary of [Text, Text]) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/page/page-setbackgroundtaskresult-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/page/page-setbackgroundtaskresult-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/page/page-setbackgroundtaskresult-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 page background task result as a dictionary.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"Page.SetBackgroundTaskResult(Dictionary of [Text, Text]) Method","slug":"pagesetbackgroundtaskresultdictionary-of-text-text-method","at":0,"chars":2186},{"level":2,"title":"Syntax","slug":"syntax","at":303,"chars":87},{"level":2,"title":"Parameters","slug":"parameters","at":390,"chars":157},{"level":2,"title":"Remarks","slug":"remarks","at":547,"chars":530},{"level":2,"title":"Example","slug":"example","at":1077,"chars":942},{"level":2,"title":"Related information","slug":"related-information","at":2019,"chars":167}],"text":"# Page.SetBackgroundTaskResult(Dictionary of [Text, Text]) Method\n> Version: _Available or changed with runtime version 4.0._\nSets the page background task result as a dictionary. When the task is completed, the OnPageBackgroundCompleted trigger will be invoked on the page with this result dictionary.\n## Syntax\n```al\n Page.SetBackgroundTaskResult(Results: Dictionary of [Text, Text])\n```\n## Parameters\nResults\nType: Dictionary of [Text, Text]<../dictionary/dictionary-data-type>\nSpecifies the dictionary of results for the page background task.\n## Remarks\nYou use this method in a page background task codeunit to pass the results of the page background task codeunit to the calling page. Before calling this method, use the ../dictionary/dictionary-add-method to populate the Results dictionary with the key-value pairs that you want to pass to calling page's ../../triggers-auto/page/devenv-onpagebackgroundtaskcompleted-page-trigger. The OnPageBackgroundCompleted trigger can then handle the results on the calling page, such as updating the record in the UI or database.\n## Example\nThe following code is an example of a page background task codeunit that uses the SetBackgroundTaskResult method to set a dictionary of results that will be passed to the calling page. For more details about this example, see ../../devenv-page-background-tasks.\n```al\ncodeunit 50100 PBTWaitCodeunit\n{\n    trigger OnRun()\n    var\n        Result: Dictionary of [Text, Text];\n        StartTime: Time;\n        WaitParam: Text;\n        WaitTime: Integer;\n        EndTime: Time;\n    begin\n        if not Evaluate(WaitTime, Page.GetBackgroundParameters().Get('Wait')) then\n            Error('Could not parse parameter WaitParam');\n\n        StartTime := System.Time();\n        Sleep(WaitTime);\n        EndTime := System.Time();\n\n        Result.Add('started', Format(StartTime));\n        Result.Add('waited', Format(WaitTime));\n        Result.Add('finished', Format(EndTime));\n\n        Page.SetBackgroundTaskResult(Result);\n    end;\n}\n\n```\n## Related information\n../../devenv-page-background-tasks\npage-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}