Setting Correct Default Mode for Forms in a Canvas App | [Quick Tip]

If you are new to creating a Canvas App and you’ve just added a Form and when you try to run and test the same in the browser itself, you don’t see it.

So let’s say you’ve put a form like this

And all you see is this –

So this happens based on the Default Mode and whether the context is passed to the form depending on the type or not.

Default Mode

There are 3 Default Modes for a form and it’s critical which one should be used when –

1. Edit – To be used if you are creating a new record. While using this mode, make sure the Item (from a data source is passed to the Form itself. Else, you’ll see the same error message as above and won’t see a blank form in that case.)
The Item property should be pointed to pick .Selected i.e. typically, <GalleryName>.Selected.

Context of a record i.e. a Row should be passed on to this form for Edit mode i.e. an existing row to be passed on to this Form from the preceding Gallery/Table control (or any data source based on your implementation). For example – The context I send to the form looks like this.
The last parameter i.e. <GalleryName>.Selected is placed on the select button so that once clicked, it’ll send the record context over to the form so that the form is displaying the selected record (which is picked from Item property in the above screenshot)

2. New – New should be used if the Form you’ve inserted isn’t coming as a result of populating a selected record. But you will enter new values and Submit it the first time.
Once New is selected, the form will correctly render for you when you test or run the App once correct Mode is selected (i.e. you don’t intend to pass any context to the Form)

3. View – In this view, fields will not be visible and instead the data will be a result of the selected item from the List/Gallery view it is coming from i.e. a Data Row which will populate this form. This will be a Read-Only view.
Another form example where View is selected, fields won’t show up but this form would need Context to be passed to it just like in the New mode.

Hope this quick tip was useful.

Here are some more Dynamics 365 related posts you might want to check

  1. Find deprecated JS code used in your Dynamics 365 environment | Dynamics 365 v9 JS Validator tool | XrmToolBox
  2. Make On-Demand Flow to show up in Dynamics 365 | Power Automate
  3. Track and Set Regarding are disabled for Appointments in Dynamics 365 App For Outlook message | Demystified
  4. Cancelled Bookings Imported in Time Entries in Dynamics 365 PSA issue | [Quick Tip]
  5. Remove ‘This Email has been blocked due to potentially harmful content.’ message in Dynamics 365 Emails | OrgDbSettings utility
  6. Get GUID of the current View in Dynamics 365 CRM JS from ribbon button | Ribbon Workbench
  7. Get Dynamics 365 field metadata in a Canvas App using DataSourceInfo function | Common Data Service
  8. Dynamics 365 App For Outlook missing on SiteMap in CRM? Use shortcut link [Quick Tip]

Thank you!!

Clear a field value & Reset Form in a Canvas Power App [Quick Tip]

One of the most useful features to provide in a Form Control in a Canvas Power App is the ability to “Clear/Reset a Form” and “Clear a Field value”.

Let’s look at how Power Apps’ existing feature can help you achieve this.

Clear Field

Let’s say Description field is a lengthy field and often times, you want to clear the entire field instead of just backspacing the entire field.

  1. Let’s say Description is a DataCardValue in a typical form. Usually Descriptions are lengthy and need to be cleared if you go wrong. So, every form field value is stored in a data card value field.

  2. On the right hand properties, look for Clear Field option from the list of Text Input properties.

  3. Notice that a X appears on the field when in focus/active. So when you make a mistake in a field, click on it to clear that field.

  4. And it get’s cleared.

    This didn’t work in Multi-Line Text Box. Not sure if it’s a bug or not supported yet. I’ll confirm and update here.

Reset Form

Fairly basic way to clear out an entire form is to use a button to do so.

  1. A suitable approach is to add a ResetForm(<FormName>) function. I’ve put a sample button that denotes a reload/reset logo which I selected from Icons.

  2. Now, let’s say I want to clear this form.

  3. The form will be cleared.

Here’s a short YouTube video I created to demonstrate this –

Hope this quick tip helps!!

Here are some more Canvas Power App posts you might want to check –

  1. Get Dynamics 365 field metadata in a Canvas App using DataSourceInfo function | Common Data Service
  2. Debug Published Canvas Power App with other users using Monitor | Power Platform
  3. Download a File from a Canvas Power App using a button | Power Platform
  4. AddColumns() function to dynamically add columns to a Data table in Canvas Power App | SharePoint List
  5. Implement real-time search in Gallery of CDS records in a Canvas Power App | Power Platform
  6. Log Canvas Power App telemetry data in Azure Application Insights | Power Apps
  7. Call HTTP Request from a Canvas Power App using Flow and get back Response | Power Automate
  8. Implement character length validation in a Canvas Power App | Power Platform
  9. Send a Power App Push Notification using Flow to open a record in Canvas App | Power Automate
  10. Count of total CDS records returned in a Canvas Power App connection [Quick Tip]

Thank you!