{"title":"Best practices for Power Apps with Business Central (preview)","url":"https://jonas-paprotka.de/docs/dev-itpro/powerplatform/power-apps-best-practices/","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/powerplatform/power-apps-best-practices, 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/powerplatform/power-apps-best-practices","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":"Learn how to best develop Power Apps for Business Central","date":"2023-04-24","meta":{"topic":"best-practice"},"outline":[{"level":1,"title":"Best practices for Power Apps with Business Central (preview)","slug":"best-practices-for-power-apps-with-business-central-preview","at":0,"chars":10407},{"level":2,"title":"Working with multiple environments","slug":"working-with-multiple-environments","at":341,"chars":1121},{"level":2,"title":"Telemetry","slug":"telemetry","at":1462,"chars":321},{"level":2,"title":"Error handling","slug":"error-handling","at":1783,"chars":695},{"level":2,"title":"Explicit column selection","slug":"explicit-column-selection","at":2478,"chars":586},{"level":2,"title":"Set up multi-language support with Business Central","slug":"set-up-multi-language-support-with-business-central","at":3064,"chars":1403},{"level":2,"title":"Setup localized currency support with Business Central","slug":"setup-localized-currency-support-with-business-central","at":4467,"chars":891},{"level":2,"title":"Working with Business Central images","slug":"working-with-business-central-images","at":5358,"chars":2279},{"level":3,"title":"Updating/Uploading an image","slug":"updatinguploading-an-image","at":5505,"chars":1019},{"level":3,"title":"Parsing the media type field","slug":"parsing-the-media-type-field","at":6524,"chars":426},{"level":3,"title":"Automatic image element size","slug":"automatic-image-element-size","at":6950,"chars":687},{"level":2,"title":"When should you consider Power Apps?","slug":"when-should-you-consider-power-apps","at":7637,"chars":1939},{"level":3,"title":"Fully customizable UI","slug":"fully-customizable-ui","at":7986,"chars":239},{"level":3,"title":"Device capabilities","slug":"device-capabilities","at":8225,"chars":468},{"level":3,"title":"Mixed reality (MR) and intelligence (AI)","slug":"mixed-reality-mr-and-intelligence-ai","at":8693,"chars":386},{"level":3,"title":"Working with external data","slug":"working-with-external-data","at":9079,"chars":497},{"level":2,"title":"Coding standard with building Power Apps","slug":"coding-standard-with-building-power-apps","at":9576,"chars":613},{"level":2,"title":"Related information","slug":"related-information","at":10189,"chars":218}],"text":"# Best practices for Power Apps with Business Central (preview)\n> IMPORTANT\n> Some or all of the functionality noted in this article is available as part of a preview release. The content and the functionality are subject to change.\nThis article provides some best practices for developing canvas apps for Business Central using Power Apps.\n## Working with multiple environments\nWhen you add a Business Central connection to Power Apps, the connection information, such as the environment name and company ID, gets hard-coded into the Power App source code. This condition means that if you transfer a Power App between tenants with different Business Central environments or companies, you must update all the data connections.\nWhile Power Automate flows allow the use of environment variables to store the connection information, facilitating the move between environments, Power Apps currently lacks this functionality.\nWe've updated our Al-Go for GitHub template with the functionality to update the connection information in the Power Apps source code. So, if you've defined your Business Central environment name and company ID in the Al-go-settings file, your Power Apps (and flows) will be updated to point to the correct environment when you use the GitHub actions that are part of the Al-Go-PTE template. If your flow is using environment variables, no changes are made.\n> NOTE\n> This functionality is only available as part of the AL-Go PTE template.\n## Telemetry\nYou can add telemetry to your Power App by configuring the instrumentation key and using the trace function. Telemetry data helps you better understand how your app is operating and debug issues.\nSee Trace function in Power Apps<https://learn.microsoft.com/power-platform/power-fx/reference/function-trace>.\n## Error handling\nThere are multiple ways of catching errors in Power Apps. See Error, IfError, IsError, IsBlankOrError functions in Power Apps<https://learn.microsoft.com/power-platform/power-fx/reference/function-iferror>.\nWe recommend wrapping calls in an ifError function call. This way mimics the syntax of the well-known try/catch pattern. The following code snippet shows an example from the power-apps-samples#warehouse-helper-app:\n```javascript\nIfError(Set(varScannedItem, LookUp('warehouseItemsWithImage', GTIN = varScannedCode ))\n   ,\n   UpdateContext({ctxErrorOnItemLookup: true});\n   Trace(\"Error trying to lookup item: \"& varScannedCode, NotificationType.Error, FirstError);\n)\n```\n## Explicit column selection\nExplicit column selection is a Power Apps feature that is turned on by default for new Power Apps. When this feature is enabled, only the data columns that are used in the app get loaded. This behavior can cause problems if the columns are used indirectly or in a way the app can't predict.\nYou can use the ShowColumns function to make sure the columns you need in your app are loaded. See AddColumns, DropColumns, RenameColumns, and ShowColumns functions in Power Apps<https://learn.microsoft.com/power-platform/power-fx/reference/function-table-shaping>.\n## Set up multi-language support with Business Central\nPower Apps offers a couple of different ways of adding multi-language support to your Power App, which you learn more about at Build a multi-language app<https://learn.microsoft.com/power-apps/maker/canvas-apps/multi-language-apps>.\nBut when working with Power Apps and Business Central, the pattern we recommend is to add a Business Central API that returns the relevant strings. This approach lets you store the localization inside your AL extension and use your normal localization processes. You can choose to map all the language resources into a global object inside the Power App for easy consumption.\nYou can check out the Warehouse Helper app<https://github.com/microsoft/businesscentralsamples-warehousehelper> or the Take order app<https://github.com/microsoft/businesscentralsamples-takeorder> for examples about how it can be done. For example, in the Warehouse Helper app, consider the following points:\n The https://github.com/microsoft/businesscentralsamples-warehousehelper/blob/main/ALApp/AppCode/APIs/WareHouseLanguageResources.api.al file is the API that exposes the localized labels for Warehouse Helper.\n The https://github.com/microsoft/businesscentralsamples-warehousehelper/blob/main/WarehouseHelper/CanvasApps/src/new_bcwarehousehelper_290e3/Src/Loading%20Screen.fx.yaml file is where we do the mapping inside Power Apps.\n## Setup localized currency support with Business Central\nTo ensure the currency format in your canvas app matches the setup in Business Central, we recommend that you expose an API endpoint that provides the locale information to your Power Apps.\nWe use this pattern throughout the Take Order sample app. Once you have the locale information, you can pass in a current format pattern along with your locale to ensure that the format is correct.\nFor example, in the Take Order app, we use the following pattern:\n```javascript\nText(ctxItemDetails.'Unit Price', \"$#,##0.00\", varBcLocale)\n```\n> NOTE\n> `$` currency is just a placeholder and will be replaced by the Power Apps platform with the correct symbol based on the locale. To learn more about the text formatting options, refer to Text function in Power Apps<https://learn.microsoft.com/power-platform/power-fx/reference/function-text>.\n## Working with Business Central images\nPower Apps supports working with images from Business Central. But there are a few caveats to be aware of:\n### Updating/Uploading an image\nUploading images from Power Apps to Business Central isn't currently supported by using the standard connector. Instead, we recommend you build a simple Power Automate flow, send the image from the Power App to the flow, and use the flow's Business Central connector to upload the image.\nThe following code snippet shows an example that gets an image from the mixed-reality control and uploads it to the flow:\n```javascript\n// Call flow to upload images\nSet(varImageContent, Last(ViewInMR1.Photos).ImageURI);\nIf(Not(IsBlankOrError(varImageContent)),\n    UploadImageToSalesOrder.Run(varCreatedSalesOrder.Id, {\n                                    file:{\n                                       name:GUID() & \".png\",\n                                       contentBytes:varImageContent\n                                    }\n                                 }\n   );\n);\n```\n![Shows a screen shot of a Power Automate flows that takes an image from Power apps and uploads it to Business Central]\n### Parsing the media type field\nIf the data you're using from Business Central has a field of the type `media field` that you want to expose to Power Apps, you need to load the data from the media field into a blob and return the blob. Otherwise, Power Apps will just receive an internal string referencing the blob in Business Central.\nYou can see an example in the ItemsWithImages.api.al file of the Take Order sample app.\n### Automatic image element size\nImage controls in Power Apps don't support dynamic sizes in a fit-to-content model. The recommended approach is to include image height and width settings in API information that's returned from Business Central. This way, they can be used to set the image element height and width.\nWe're using this approach in the Warehouse helper app.\nYou can get the image dimensions in AL using the following pattern:\n```javascript\nTenantMedia.SetAutoCalcFields(Content);\nif not TenantMedia.Get(MediaID) then\n   exit;\n\nTenantMedia.Content.CreateInStream(InStr);\nCopyStream(OutStr, InStr);\n\nPictureWidth := TenantMedia.Width;\nPictureHeight := TenantMedia.Height;\n```\n## When should you consider Power Apps?\nThere are no rules for when you should consider using Power Apps. What we found useful is to highlight some Power Apps functionality that compliments Business Central well. If you find yourself implementing a scenario that could benefit from the following functionality, you should consider using Power Apps:\n### Fully customizable UI\nPower Apps canvas apps offer full control over the UI. If you're building a single purpose process or a scenario where the Business Central UI patterns don't fit well, Power Apps could be a good solution for you.\n### Device capabilities\nPower Apps has many device capabilities that are wrapped in easy-to-use components. If you need access to a barcode scanner, camera measurements, or other device capabilities, we recommend that you check out Power Apps to see it already offers a component that wraps the functionality you need. See Create a canvas app with the barcode reader control<https://learn.microsoft.com/power-apps/maker/canvas-apps/how-to/create-app-barcode-scanner>.\n### Mixed reality (MR) and intelligence (AI)\nPower Apps offer native integration with MR and AI through the UI components and AI Builder integration. For more information, see:\n Working with MR in Power Apps<https://learn.microsoft.com/power-apps/maker/canvas-apps/mixed-reality-component-view-mr>\n Working with AI Builder in Power Apps<https://learn.microsoft.com/ai-builder/overview>\n### Working with external data\nThe core of Power platform is working with data. Through the connector ecosystem, you get access to more than 1000 connectors that let you connect to Microsoft data sources like SharePoint, OneDrive, Business Central, and more. You can also connect to non-Microsoft data sources like Dropbox, MailChimp, Adobe, DocuSign, and more.\nYou can see the full list of supported connectors at Power Automate Connectors<https://powerautomate.microsoft.com/en-us/connectors/>.\n## Coding standard with building Power Apps\nUsing a uniform set of rules when building Power Apps makes the project more manageable and reduces the change of coding mistakes. For some general best practice resources for building Power Apps, see the following links:\n Power Apps canvas app coding standards and guidelines<https://learn.microsoft.com/power-apps/guidance/coding-guidelines/overview>\n Power Apps Community Call<https://www.youtube.com/watch?v=cJzomM29vNI&t=39s>\n Tips and best practices to improve performance of canvas apps<https://learn.microsoft.com/power-apps/maker/canvas-apps/performance-tips>\n## Related information\nBusiness Central and Power Apps<power-apps-overview>\nApplication lifecycle management for Power Apps in Business Central<power-apps-alm>\nSample Power Apps for Business Central<power-apps-samples>"}