| Editorial Team
Calling and Working with Data in Dynamics 365 Canvas Apps
![](../img/blog/blog-c-&-w-data-1.jpg)
In Dynamics 365, particularly within the context of a Canvas App, calling and working with data is a fundamental aspect. Canvas Apps allow you to create custom applications connecting to various data sources. Here’s a step-by-step guide on how to call and work with data in a Canvas App within Dynamics 365:
Connecting to a Data Source:
- Open the Canvas App:
- Navigate to Power Apps within Dynamics 365.
- Open or create a Canvas App using the Power Apps Studio.
- Add a Data Source:
- In the left pane, click on “Data” to expand the data sources.
- Click on “Add data” to connect to a data source. This could be a Common Data Service (CDS), SharePoint, SQL Server, or another supported data connector.
Displaying Data in a Gallery:
- Insert a Gallery:
- Drag and drop a Gallery control onto the canvas. This will serve as the container for displaying your data.
- Set the Gallery Items Property:
- In the properties pane for the Gallery, set the “Items” property to the data source you connected to in step 2. For example, if you connected to a SharePoint list, set it to ‘DataSourceName’.
- Design the Gallery:
- Customize the appearance of the Gallery to display the desired fields from your data source. You can add labels, images, and other controls inside the Gallery to represent each record.
Interacting with Data:
- Add Controls for Interaction:
- Add controls like buttons or icons inside the Gallery to allow users to interact with the data. For instance, you can add a button to view details or edit a record.
- Implement Data Actions:
- Use the OnSelect property of controls to implement actions. For example, you might use the OnSelect property of a button to navigate to a details screen or update a record in the data source.
Filtering and Sorting Data:
- Implement Filtering:
- Use the Filter function to display a subset of data based on certain criteria. For example, you might filter records based on a status or date range.
- Implement Sorting:
- Utilize the Sort function to arrange records in a specific order. For instance, you can enable users to sort data by clicking column headers.
Testing and Preview:
- Preview Your App:
- Click on the “Play” button to preview your Canvas App. Test the functionality to ensure data is displayed correctly and interactions are working as expected.
Save and Publish:
- Save and Publish:
- Once satisfied with your Canvas App, save your changes and publish the app. This makes the updated version available to end-users.
Following these steps, you can effectively call and work with data in a Canvas App within Dynamics 365, providing your users with a customized and tailored experience.