QuestionQ418

Create and configure Power Apps

You are developing a model-driven app for a company.

When you create a new Account record, you must automatically show a form to gather data that is required to create a Contact record. The form must change to the appropriate layout based on the contact type.

You open the Contact form by using JavaScript. You pass the contact type information to the form by using the Xrm.Navigation.openForm function. An OnLoad event handler in the Contact form processes the data and shows only the appropriate sections of the form for the given contact type.

You need to configure the receiving form to accept the data parameter.

Solution: In the form editor, add a query string parameter for the data parameter.

Does this solution achieve the goal?

  • A Yes
  • B No
Explanation

The goal in this repeated-answer set is to configure a receiving model-driven form so it will accept a custom parameter passed to it (for example via Xrm.Navigation.openForm). Microsoft's documented, supported way to make a form accept a custom query string parameter is to open the form editor, choose Form Properties, and add the parameter on the Parameters tab (or edit the FormXml). That is exactly what this solution does, so it achieves the goal. The competing solution in this set (adding a web resource that sets formContext.data attributes) does not, because JavaScript alone cannot register the form to accept an unexpected parameter. Note that custom parameter names must contain an underscore and cannot begin with 'crm_'.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!