Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
By defining or changing the table definitions, you can control the capabilities of a table. To view the table definitions for your environment, use the metadata browser. Browse table definitions in your environment.
More information: Browse table definitions for your environment
This article is about how to work with tables programmatically. To work with tables in Power Apps See Tables in Dataverse.
Tables can be created using either the SDK for .NET or the Web API. The following information can be applied to both.
- With the SDK for .NET, use the EntityMetadata class. More information: Create a custom table using code and Retrieve, update, and delete tables
- With the Web API, use the EntityMetadata EntityType. Learn to create and update table definitions using the Web API
Table definitions operations
How you work with table definitions depends on which service you use.
Since the Web API is a RESTful endpoint, it uses a different way to create, retrieve, update, and delete table definitions. Use POST, GET, PUT, and DELETE HTTP verbs to work with table definitions entity types. Learn to create and update table definitions using the Web API
One exception to this is the RetrieveMetadataChanges Function provides a way to compose table definitions query and track changes over time.
If working with SDK for .NET, use RetrieveMetadataChangesRequest class. This class contains the data that is needed to retrieve a collection of table definitions records that satisfy the specified criteria. The RetrieveMetadataChangesResponse returns a timestamp value that can be used with this request at a later time to return information about how table definitions changed since the last request.
| Message | Web API | SDK Assembly | 
|---|---|---|
| CreateEntity | Use a POST request to send data to create a table. | CreateEntityRequest | 
| DeleteEntity | Use a DELETE request to delete a table. | DeleteEntityRequest | 
| RetrieveAllEntities | Use GET request to retrieve table data. | RetrieveAllEntitiesRequest | 
| RetrieveEntity | RetrieveEntity Function | RetrieveEntityRequest | 
| UpdateEntity | Use a PUT request to update a table. | UpdateEntityRequest | 
| RetrieveMetadataChangesUsed together with objects in the Microsoft.Xrm.Sdk.Metadata.Query namespace to create a query to efficiently retrieve and detect changes to specific table definitions. More information: Retrieve and detect changes to table definitions. | RetrieveMetadataChanges Function | RetrieveMetadataChangesRequest | 
Options available when you create a custom table
The following lists the options that are available when you create a custom table. You can only set these properties when you create a custom table.
| Option | Description | 
|---|---|
| Create as custom activity | You can create a table that is an activity by setting the IsActivityproperty when using the SDK for .NET or Web API respectively. For more information, see Custom Activities in Dynamics 365. | 
| Table Names | There are two types of names, and both must have a customization prefix: LogicalName: Name that is the version of the table name that is set in all lowercase letters.SchemaName: Name used to create the database tables. This name can be mixed case. The casing that you use sets the name of the object generated for programming with strong types or when you use the REST endpoint.Note: If the logical name differs from the schema name, the schema name overrides the value that you set for the logical name. When a table is created in the application in the context of a specific solution, the customization prefix used is the one set for the Publisherof the solution. When a table is created programmatically, you can set the customization prefix to a string that is between two and eight characters in length, all alphanumeric characters and it must start with a letter. It can't start withmscrm. The best practice is to use the customization prefix defined by the publisher that the solution is associated with, but this best practice isn't enforced. An underscore character must be included between the customization prefix and the logical or schema name. | 
| Ownership | Use the OwnershipTypeproperty to set how table records are owned. Use the OwnershipTypes enumeration or OwnershipTypes EnumType to set the type of table ownership. The only valid values for custom tables areOrgOwnedorUserOwned. For more information, see Table ownership. | 
| Primary Column | With the SDK for .NET, use CreateEntityRequest.PrimaryAttribute property to set the primary column. With the Web API, the JSON defining the table must include one StringAttributeMetadata with the IsPrimaryNameproperty set to true.In both cases, string column must be formatted as Text. The value of the primary column is what is shown in a lookup for any related tables. Therefore, the value of the column should represent a name for the record. | 
Enable table capabilities
The following lists table capabilities. You can set these capabilities when you create a table or you can enable them later. Once enabled, these capabilities can't be disabled.
| Capability | Description | 
|---|---|
| Business Process flows | Set IsBusinessProcessEnabledto true in order to enable the table for business process flows. | 
| Notes | To create a relationship with the Annotationtable and enable the inclusion of a Notes area in the form. By including Notes, you can also add attachments to records.With the SDK for .NET, use the CreateEntityRequest or UpdateEntityRequest HasNotespropertyWith the Web API, set the EntityMetadata. HasNotesproperty. | 
| Activities | To create a relationship with the ActivityPointertable so that all the activity type tables can be associated with this table.With the SDK for .NET, use the CreateEntityRequest or UpdateEntityRequest HasActivitiesproperty.With the Web API, set the EntityMetadata. HasActivitiesproperty. | 
| Connections | To enable creating connection records to associate this table with other connection tables set the IsConnectionsEnabled.Valueproperty value to true. | 
| Queues | Use the IsValidForQueueproperty to add support for queues. When you enable this option, you can also set theAutoRouteToOwnerQueueproperty to automatically move records to the owner's default queue when a record of this type is created or assigned. | 
| Set the IsActivityPartyproperty so that you can send e-mail to an e-mail address in this type of record. | 
Editable table properties
The following lists table properties that you can edit. Unless a managed property disallows these options, you can update them at any time.
| Property | Description | 
|---|---|
| Allow Quick Create | Use IsQuickCreateEnabledto enable quick create forms for the table. Before you can use quick create forms, you must first create and publish a quick create form.Note: Activity tables don't support quick create forms. | 
| Access Teams | Use AutoCreateAccessTeamsto enable the table for access teams. See About collaborating with team templates for more information. | 
| Primary Image | If a table has an image column, you can enable or disable displaying that image in the application using PrimaryImageAttribute. Learn to work with image column definitions using code | 
| Change display text | The managed property IsRenameableprevents the display name from being changed in the application. You can still programmatically change the labels by updating theDisplayNameandDisplayCollectionNameproperties. | 
| Edit the table Description | The managed property IsRenameableprevents the table description from being changed in the application. You can still programmatically change the labels by updating theDescriptionproperty. | 
| Enable for use while offline | Use IsAvailableOfflineto enable or disable the ability of Dynamics 365 for Microsoft Office Outlook with Offline Access users to take data for this table offline. | 
| Enable the Outlook Reading Pane | Note: The IsReadingPaneEnabledproperty is for internal use only.To enable or disable the ability of Office Outlook users to view data for this table, use the Outlook reading pane. You must set this property in the application. | 
| Enable Mail Merge | Use IsMailMergeEnabledto enable or disable the ability to generate Office Word merged documents that use data from this table. | 
| Enable Duplicate Detection | Use IsDuplicateDetectionEnabledto enable or disable duplicate detection for the table. For more information, see Detect duplicate data using code | 
| Enable SharePoint Integration | Use IsDocumentManagementEnabledto enable or disable SharePoint server integration for the table. For more information, see Enable SharePoint document management for specific entities. | 
| Enable Dynamics 365 for phones | Use IsVisibleInMobileto enable or disable the ability of Dynamics 365 for phones users to see data for this table. | 
| Dynamics 365 for tablets | Use IsVisibleInMobileClientto enable or disable the ability of Dynamics 365 for tablets users to see data for this table.If the table is available for Dynamics 365 for tablets, you can use IsReadOnlyInMobileClientto specify that the data for the record is read-only. | 
| Enable Auditing | Use IsAuditEnabledto enable or disable auditing for the table. For more information, see Configure table and columns for Auditing. | 
| Change areas that display the table | You can control where table grids appear in the application Navigation Pane. This is controlled by the SiteMap. | 
| Add or Remove Columns | As long as the managed property CanCreateAttributes.Valueallows for creating columns, you can add columns to the table. For more information, see Column definitions. | 
| Add or Remove Views | As long as the managed property CanCreateViews.Valueallows for creating views, you can use theSavedQuerytable to create views for a table. | 
| Add or Remove Charts | As long as the managed property CanCreateCharts.Valueallows for creating charts and theIsEnabledForChartstable property is true, you can use the SavedQueryVisualization table to create charts for a table. For more information, see View data with visualizations (charts). | 
| Add or Remove table relationships | There are several managed properties that control the types of relationships that you can create for a table. For more information, see Table relationship definitions. | 
| Change Icons | You can change the icons used for custom tables. For more information, see Change model-driven app custom table icons | 
| Can Change Hierarchical Relationship | CanChangeHierarchicalRelationship.Valuecontrols whether the hierarchical state of relationships included in your managed solutions can be changed. | 
| Entity set name | EntitySetNamespecifies the name used to uniquely identify the table using the Dataverse Web API. This is usually the same as theLogicalCollectionName, but you can't change theLogicalCollectionName. You should only changeEntitySetNamebefore any code is written using the default entity set name. Learn more about entity set names | 
Messages supported by custom tables
Custom tables support the same base messages as system tables. The set of messages available depends on whether the custom table is user-owned or organization owned. User-owned tables support sharing, so messages such as GrantAccess, ModifyAccess, and RevokeAccess are available.
See also
Use the Web API with table definitions
Work with table definitions using the SDK for .NET