Using checkbox in a canvas apps gallery

This article illustrates about using the checkbox inside a gallery in canvas apps

Step 1: Create a gallery and set the properties of the gallery as below:

Data source : Contacts
Layout: Title
Clear the default value in the title
GalleryProperty

Step 2: Add checkbox from the input options inside the gallery and set the “Text Property” of the checkbox to ‘Full Name’ from the Contact.
Now this will display the Contact’s Full Name next to the check box

checkbox

Step 3: Add the checked items in the gallery to a collection
This is done by setting the “OnCheck” property to “Collect(checkedcontacts,{name:Gallery1.Selected.’Full Name’})

checkedcollection

Step 4: Remove the items from the collection when the item in gallery is Unchecked
This is done by setting “OnUncheck” property to :
Remove(checkedcontacts,First(Filter(checkedcontacts,name = ThisItem.’Full Name’)),All)

Uncheck

Step 5: To test this, add a data table and set the items property as in the Image below.

Datatable

Step 6: Go to the fields property of the data table click edit and chose the field as below

DataField

 

Step 7: Play the app and test it by checking and unchecking the checkbox in a gallery and view the corresponding data in the data table

TestCheck

 

 

 

 

 

 

Thanks,
Shayan

 

 

Setting From and To fields for activities in CDS Current Environment

I happened to face an issue(if i can call this as an issue) while trying to create an activity record using CDS (current environment) trigger with create action, where the option to set From and To fields were unable to get the dynamic values.

FromFieldinCds__01

After going through this Microsoft document (ActivityParty entity) , was able to resolve it by entering custom value.

Click on the icon ( switch to input entire array) to the right corner of create action and you can see the participationtypemask set to custom value.

participationtypemask__01

Below is the result of the flow execution

successflowrun

Below are the results from D365

LettergeneratedinCDS

LetterRecord__01

Hope this helps!

 

 

Thanks!
Shayan

Dependent dropdowns in Canvas Apps : Sorting, Lookup and Filter

Introduction:
Drop down is one of the commonly used input types in canvas app development.
This article illustrates the use of sorting, lookup and filter in case of using cascading dropdowns.

Scenario:
Consider two entities in the CDS, which is country and state with a 1:N relationship between them. The state dropdown should display relevant states based on the selected country from the country dropdown.

Data:
Countries :
India, Turkey and UK
States:
Karnataka, Delhi and Kerala (country:India)
Antalya, Istanbul and Cappadocia (country:Turkey)
Bristol, Manchester and Liverpool (country:UK)

Canvas Apps:
Let us add 3 dropdown inputs in the canvas app and see how to achieve this scenario.

Dropdown1

Country dropdown will be used to display country information and data source will be country entity in CDS.
Set the formula for the items property as : Sort(Distinct(Countries,Name),Result)
This formula will fetch the distinct countries based on the name and sort the result alphabetically

State dropdown with filters will be used to display the state information and data source will be state entity in CDS.
Set the formula for the items property as:
SortByColumns(Filter(States,Country.Name=dd_Country.SelectedText.Value),”new_name”)
This formula will filter the states based on the country dropdown selected value and sorts the result by the state name alphabetically. 

dropdown3filterdropdown2

State dropdown 2 uses the lookup function to lookup the country that is selected in the country drop down and then displays the state results for that country, here there results are not filtered and displayed in the order the are returned.
Set the formula for the items property as:
LookUp(Countries,Name=dd_Country.Selected.Result).States.Name
This formula will lookup to countries in the cds based on the country drop down selected result and then displays the states for the selected country

dropdown3nofilter

 

Thanks,
Shayan