Add Custom Business Logic to Main Form: Business Rules vs. Client Script - PL-400 Exam Question | Microsoft Power Platform Developer

Client Script Implementation for Main Form Operations

Question

You create a model-driven app.

You need to add custom business logic to the main form.

You consider what to use better for your business requirements: the business rules or client script.

Please select all the main form operations that need or benefit more from the client script's implementation.

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E. F.

Correct Answers: B, D and F

Power Platform provides a variety of tools to extend the platform and user experience.

If you need to work with the Dataverse, you can use Dataverse Web API and Organization service.

Or develop your business logic by using the Dataverse plug-ins.

You can use Data import, Synchronization, Virtual entities, Azure integration, and Webhooks for integration purposes.

Before you start coding any additions or extensions to the apps, you need to consider the alternatives that Power Platform already provides to save your time and automatically integrate the outputs within the platform.

The Dataverse declarative options for the business logic include the use of business rules, Real-time workflows, actions, and Power Automate flows for your business requirements.

You need to evaluate your business requirements and decide what type of solution you should use: declarative or code.

Option B is correct because if you need to use the data from related tables, you need to use a client script or a Web API.

Option D is correct because if you need to update fields based on data changes in a form, it is better to use a client script.

After all, the business rule updates data only on the data retrieval during the form load or refresh.

Option F is correct because if you need to run a business logic OnSave you have to use the client script because the business rules run logic on a form load or refresh.

For all other options, the business rules are better out-the-box solutions than client scripts.

For more information about the use of the declarative or code Power Platform solutions, please visit the below URLs:

When creating a model-driven app, you have the option to add custom business logic to the main form using either business rules or client scripts. In order to determine which approach to use, you need to consider the specific requirements of your business.

Client scripts are a type of JavaScript code that can be used to customize the behavior of a model-driven app. They can be used to add custom logic to form events, such as OnLoad, OnSave, and OnChange. Client scripts run on the client-side, meaning they are executed in the user's web browser.

Here are the main form operations that would benefit more from the client script's implementation:

A. Set field values If you need to set a field value based on some other field's value, you can use client script to update the field value on the form.

B. Referencing related data If you need to reference related data in the form, client script is a better option. It can fetch related data using Web API and update the form fields accordingly.

C. Running business logic on a form load If you need to run any custom logic when the form loads, client script is the way to go.

D. Instant update of the form fields If you want to instantly update form fields based on user input, client script is the better option as it can provide an instant response to user interaction.

E. Show and hide fields If you need to show or hide certain fields based on user input or business logic, client script can be used to accomplish this.

F. Running business logic when you save the record. If you need to run custom logic when the record is saved, client script is the better option as it can execute the code on the client-side.

In conclusion, while business rules can be a helpful tool for adding simple, declarative logic to a model-driven app, client scripts are often the better choice when you need to implement more complex logic that requires real-time feedback and user interaction.