en en en de en en en da da it da it da da es en da da en da da de da da da sv da en da en en en da pt fr fr de sv da da sv da da lt en en en en en it en pt en kn en en en en kn en en en en en en en en en en en en en en en da da da tr da en en en en en en en en en ca en en lt en en en en en en en kn da en en nl nl da en da de de en en nl en en nl nl sv en da de de en en nl en en nl nl sv en da de de en en nl en en sv nl da en da de da en en nl en en nl nl sv en da da da en en nl en en nl nl sv en da da da en en nl en en nl nl sv en da de de en en de da da en en da da en da ms en en en en sv da fr da da en en en zh da de en en en en it en da da en da da da
HTML template based on dynamic data in PowerApps | Microsoft Power Apps
Ressourcer til markedslanceringstjenester til partner
Vasavi Bhaviri Setty, Senior Program Manager, 31. maj 2018
Using HTML templates is a great way to format and display data within in PowerApps applications, to generate reports and to send emails using te app. We come across many scenarios where there is a need to combine HTML markup with dynamic data. One such scenario is explained in te blog here, which talks on how to actually combine te data with HTML tags. Another quick scenario I could think of is to generate a report after an inspection.
In te article below, we will go a bit deeper and generate te HTML template with dynamic data in a much appealing way. Here is another blog, using Microsoft Flow to create a PDF document from HTML template with Dynamic data.
Assume you have a Conference app. As users register for te conference, a confirmation email with details of te conference will be sent to each signed up user.
Assuming te data is already available in a context variable, an object called Session, here is a sample email template with HTML tags and application data embedded. Let’s call it as Template1.
In this approach, we are hardcoding application data inline in te HTML template. And, maintenance gets harder as for any change in data and we are forced to modify te template.
Let’s store placeholders inline in te HTML template instead of hardcoded application data values. Te placeholders will be in te format of {i}, where ‘i’ refers to index of te placeholder being replaced. Let’s call this as Template2.
You can store te index and te application data values in a local collection. Use a ForAll loop and replace te placeholders with actual values from te local collection.
First, let’s create an external source where we store our template. You can use any data source but for this blog, I'm going to use data from a static excel. Let’s call this Settings.
Let’s assume you also have another source holding your actual conference data. Let’s call it Sessions
On te OnVisible event of Confirmation Screen:
Create a collection SessionInfo using values from te selected session.
Collect te Settings into a local collection called AppSettings. We don’t want to modify te original template and hence storing it locally.
Next step is to update te template with placeholders to dynamically embed actual Session Details inline.To do this, we need to loop through each of te indices in SessionInfo, for each index, find its placeholder within te template, and replace that placeholder index with its associated Value.
At this point, you have a HTML template with application data embedded inline. And you can send this confirmation template as part of your email.
Benefits with te new approach:
With this approach, you are avoiding hardcoding of your application data inline.
Easier to store data and make modifications as there is separation between data and te template.
Cleaner and more elegant way to view your template, and easy to debug.
Check out te sample app here
Hvad er Power Apps?
Power Apps er en tjeneste til oprettelse og brug af brugerdefinerede virksomhedsapps, der opretter forbindelse til dine data og fungerer på tværs af nettet og mobil – uden at du skal bruge tid og penge på brugertilpasset softwareudvikling.
Application Lifecycle Management (ALM)
Power Platform Admin Center
Lad os komme i gang
Angiv din arbejds- eller skolekonto for at komme i gang.
Når du tilmelder dig, accepterer du servicebetingelserne.
Erklæring om beskyttelse af personlige oplysninger
Beskyttelse af personlige oplysninger og cookies
čeština dansk Deutsch (Österreich) Deutsch (Schweiz) Deutsch (Deutschland) Eλλnvιkά English (Australia) English (Canada) English (Cyprus) English (UK) English (Ireland) English (India) English (Malaysia) English (New Zealand) English (Singapore) English (US) English (South Africa) español (España) español (México) français (Belgique) français (Canada) français (Suisse) français (France) suomi magyar italiano (Svizzera) italiano (Italia) 日本語 한국어 norsk bokmål Nederlands (België) Nederlands (Nederland) polski português (Brasil) português (Portugal) pycckий svenska ไทย Türkçe 中文(简体) 中文(繁體) العربية עברית