Professional Documents
Culture Documents
Hands-on Lab
Table of Contents
Lab Overview..................................................................................................................................................................... 1
Environment .................................................................................................................................................................................. 1
Scenario ............................................................................................................................................................................................ 1
Exercise 1 – Add Relationships and review existing entitles ........................................................................ 3
Task 1: Import the starting solution .................................................................................................................................... 3
Task 2: Record primary speaker for session..................................................................................................................10
Task 3: Add the lookup field to the model-driven app form. ..................................................................................12
Task 4: Record session attendance ....................................................................................................................................14
Task 5: Correct behavior on Event to Session 1:N relationship ............................................................................15
Exercise 2 - Show session details on canvas app.............................................................................................. 18
Task 1: Explore canvas application ....................................................................................................................................18
Task 2: Complete event screen session gallery ............................................................................................................20
Task 3: Populate the Count of Speakers and Attendees............................................................................................20
Task 4: Show the name of the Event Owner...................................................................................................................22
Exercise 3 – Record session attendance............................................................................................................... 24
Task 1: Set the Session Attendance Count ......................................................................................................................24
Task 2: Set Session Primary Speaker ................................................................................................................................24
Task 3: Add controls and enable attendee registration ............................................................................................25
Task 4: Test your work ............................................................................................................................................................28
Lab Overview
Environment
The lab requires a PowerApps environment with a Common Data Service (CDS) database created
and the sample apps installed.
Scenario
This lab is designed to help you understand how to work with Common Data Service relationships
in both canvas and model-driven PowerApps.
Contoso has built an event management solution and designed a CDS data model that includes the
follow:
• Events
• Sessions
• Registration for attendees and speakers
• Association of sessions and speakers
• Automatic generation of the unique registration number
• Restrictions for event registration (a contact only can only be registered once for an event
and registration type, e.g. speaker).
The following is a simple diagram of the data model:
To make it easy for you to get started we have pre-created this part of the data-model in CDS and
have provided you with a solution that contains the entity definitions. Also included in there is a
model-driven and canvas app. The model-driven app is intended to be used by the office staff to
manage setup and registration for the event. The canvas app is intended to be used the day of the
event to quickly lookup information and to mark who attended what session.
With the current data model-above, Contoso doesn’t know who the primary speaker is at a
session. They also don’t know which contacts attended each session. As part of this lab you will
be modifying the data model to:
1. Designate one of the speakers as the primary
2. Record session attendance
The person who was building the canvas app didn’t know how to work with all of the related data,
so it is only partially completed. In this lab you will be helping Contoso finish the canvas app by
adding working with the data relationships in the app.
Exercise 1 – Add Relationships and review
existing entitles
In this exercise you will be importing the pre-built assets into your development environment and
then making the changes to the CDS data model to add the new relationships.
3) Click Browse.
4) Select the EventManagementBase.zip file locate in the lab resources folder and click
Open.
5) Click Next.
11) You should see the entities shown in the image below.
16) Filter on Option set, Process, and Other, and examine what is in under each category.
17) Select Apps and click to open the Event Management application.
21) Enter Taking your Dynamics 365 users farther for name, provide Start and End
dates/time and click Save.
25) Select Denver Dynamics Day for Event, enter From classic to unified in 30 minutes for
Name, provide Start and End dates/time and click Save.
30) Select Nancy Anderson for Contact, select Attendee for Registration Type, and click
Save.
31) Registration code should get generated.
32) Select Registrations and add the rest of the registrations shown in the image below.
Contact Registration Type Paid Fee
Yvonne McKay Speaker Yes 15000
Susanna Stubberod Speaker Yes 15000
Scott Konersmann Attendee No
Robert Lyon Attendee No
Paul Cannon Attendee No
In this task, you will create 1:N relation between Contact and Session and add primary speaker
lookup field to the Session form.
1) Navigate to https://make.powerapps.com/ and make sure you are in the correct
environment.
2) Select Solutions and open the Event Management solution.
5) Select Many-to-One.
6) Select Contact for Related (One), enter Primary Speaker for Display Name, and click
General.
7) This is an internal name and it is required to be unique. When you have multiple 1:N
relationships between the same entities it is best give it a meaningful name. Change the
name to contact_session_primaryspeaker. Click Done.
2) Drag the Primary Speaker field to the form and drop it above the Summary field.
3) Select the Primary Speaker field.
4) Go to the properties pane, change the Default View to Registered Speakers, and uncheck
the Allow Users to Change checkbox.
5) Click Save.
6) Click Publish.
7) Click on the Back button.
Task 4: Record session attendance
1) Navigate to https://make.powerapps.com/ and make sure you are in the correct
environment.
2) Select Solutions and open the Event Management solution.
5) Select Many-to-Many.
6) Select Session for Related (Many), enter attended_sessions for Relationship Name,
and click Done.
• Referential, Restrict Delete: Any related records can be navigated to. Actions taken on the parent record will not be
applied to the child record, but the parent record cannot be deleted while the child record exists.
• Parental: Any action taken on a record of the parent entity is also taken on the related child entity records.
4) Select the Relationships tab and click to open the Event relationship.
4) Click Allow.
5) The designer should load with an error. You will fix the error in Task 2.
6) Select the MainScreen.
7) Hold the ALT key of your keyboard and click on the Event.
8) The visible controls will change.
9) Click on the … button of the App and select Run OnStart. This action will reset the
application its initial state.
Task 2: Complete event screen session gallery
1) Select the SessionGallery.
2) Set Items to the formula below. This will use the 1:N relationship between Event and
Session to get to the sessions of the selected event. The error that was showing next to the
gallery should go away and you should start seeing some session data when you drill into
an event.
EventGallery.Selected.Sessions
3) Select lblCountAttendees and set the Text value to the formula below.
CountIf(EventGallery.Selected.Registrations, 'Registration Type' =
[@'Registration Type'].Attendee)
4) You will now fix the errors. Select the View tab and click Data Sources.
3) Change the Text value of lblSpeakerName from “James Phillips” to the formula below.
SessionGallery.Selected.'Primary Speaker'.'Full Name'
Task 3: Add controls and enable attendee registration
1) Expand/select the SessionScreen
2) Select the Insert tab and click Label.
5) Click Button.
9) Select iconLookupAttendee.
10) Select the OnSelect property and set it to the formula below. This sets a variable
ScanAttendee to the first contact that matches entered registration code, sets a variable
ScanAttendeeName to the full name of the contact.
Set(ScanAttendee,First(Filter(Registrations,'Registration
Code'=txtAttendeeCode.Text)).Contact);Set(ScanAttendeeName,ScanAttendee.'Full
Name');
12) Select ButtonRegister and set the DisplayMode value to the formula below. This formula
will enable the button only when a valid attendee is found.
If(IsBlank(ScanAttendeeName), DisplayMode.Disabled, DisplayMode.Edit)
13) Set the OnSelect property of the ButtonRegister to the formula below. This formula will
associate session and attendee, and clears out variables and control.
Relate(
LookUp(Sessions, Session =
SessionGallery.Selected.Session).contoso_attended_sessions, ScanAttendee);
Reset(txtAttendeeCode);
Set(ScanAttendee, Blank());
Set(ScanAttendeeName, Blank());
5) Select the Sessions tab and click to open one of the sessions.
6) You should have a Primary Speaker lookup on the form. Click on the lookup.
7) You should only see the speaker registration types and the Change View button should be
disabled. Select Yvonne McKay.
8) Select Registrations and double click to open one of the registration records.
26) You should see the contact you used to test the canvas application.