Requirement
Create appointments for customers using the Canvas app and display existing appointments in a gallery control.
Details
We are going to create a sample canvas app where we will have two screens, in the first screen we will be displaying existing appointments and we will use the second screen to create a new appointment. So let us see how we can do that.
You need to have access to the Power Platform environment.
Open https://make.powerapps.com/ and select Canvas app under apps.
Click on the Phone layout option under Blank App. After that, you will be on the power apps designer and may get the following pop up, select Create a gallery option,
Select Appointment under the data source of the gallery control, we can change the layout of the gallery control to text from the property window.
Click on New Screen and add Form screen, make sure the default mode of the form is set to New,
Click on a database and select appointments
Now let’s select field of appointment, so click on Field and select field like below,
If you will select a field like the above screen you will notice other fields are control rendered but there is no control under data card. This is because regarding field is a Polymorphic lookup that can refer to different types of entities. You can refer to details for these lookups
here. While working with these types of lookup we can’t directly map data cards to these types of fields. Instead, we need to use
AsType to map this lookup to a particular entity, for example, let’s say we want to create appointments for the customer in our example.
Now select the regarding data card, add a label, and a drop-down in the regarding data card. Change label text to Account, and set drop-down properties like below,
Now select the drop-down control and use the following formula,
Now our form is ready. To go back to the gallery screen add on + icon and use the write a formula to navigate to the next page where we can add an appointment.
Save and Publish your app. Now when you will run your app you will see a list of the existing appointments and when you will click on the
+ sign it will take you to the appointment add screen.
.
Summary
This is how we can create activity records from the Canvas app just like we created appointment records and setup regarding the field.
Hope it will help someone!
Keep learning, Keep sharing !!