Use Javascript in Power Pages to Set Lookups

Sending
User Review
0 (0 votes)

 

 

Microsoft Power Pages is a low-code, secure, enterprise-grade platform for creating, hosting, and managing modern external-facing business websites. It is part of the Microsoft Power Platform family which also includes Power Apps, Power Automate, Power BI, and Power Virtual Agents.

What is Power Pages?

Power Pages is great because it allows you to create web pages with the familiarity of PowerApps. There are some limitations when using some of the out-of-the-box tools available for model-driven apps. One of these limitations include the lack of business rules. That means if you need to apply any logic to forms in power pages, you’re going to need JavaScript. Most of the time this is a simple enough thing to implement. However, one case where it isn’t so straightforward is when setting lookup columns. Let’s take a look at what it takes.

Adding JavaScript to Power Pages

To add JavaScript to a basic form you go to the bottom of the additional detail’s tabs. For multi-step forms, you go to the desired step and scroll to the bottom of the form options tab. Here, you can add some code that looks like this:

The third line will trigger the JavaScript whenever the form is loaded. The second will also trigger it whenever the columns with the logical name ‘btg_logicalname’ is changed.

Setting the Lookup

Now let’s look at how we can set a lookup. For most column types, setting the value is a simple line of code. For lookups, we need to use… (Read full post on www.beringer.net)

 

 

The post Use Javascript in Power Pages to Set Lookups appeared first on CRM Software Blog | Dynamics 365.