Execute FetchXML from a Power Pages web template

This post presents an example of retrieving data (via FetchXML in a web template) from Dataverse and displaying the data on a Power Pages web page (via custom JavaScript on a multistep form). This retrieval being triggered when the web page loads, with the FetchXML being executed on the server

For an example of executing FetchXML on the client side, have a look at Execute FetchXML from a power pages multistep form

In detail

The process described in the following steps is regarding the population of the Licence Fee’ field displayed in Figure 1

Web template

When the multistep form (Figure 1) loads, the web template (Figure 2)

  • Performs server-side rendering and retrieves the licence fee value from Dataverse
  • (It then) populates the multistep form field ‘LicenceFeeHidden’ (line 17 in Figure 2)

Custom JavaScript

  • In the custom JavaScript of a multistep form, the field ‘LicenceFeeHidden’ is retrieved (line 15 Figure 4)
  • The value of ‘LicenceFeeField’ is then set (lines 20 & 29)
Figure 1 – The multistep form
Figure 2 – The web template
Figure 3 – The web template is referenced in the web page
Figure 4 – The multistep (General Details) form’s JavaScript

Further reading

Create a power pages web page

References

https://learn.microsoft.com/en-us/power-pages/configure/web-templates