@@ -1636,6 +1636,7 @@ def _create_table(
16361636 schema : Dict [str , Any ],
16371637 solution_unique_name : Optional [str ] = None ,
16381638 primary_column_schema_name : Optional [str ] = None ,
1639+ display_name : Optional [str ] = None ,
16391640 ) -> Dict [str , Any ]:
16401641 """Create a custom table with specified columns.
16411642
@@ -1647,6 +1648,8 @@ def _create_table(
16471648 :type solution_unique_name: ``str`` | ``None``
16481649 :param primary_column_schema_name: Optional primary column schema name.
16491650 :type primary_column_schema_name: ``str`` | ``None``
1651+ :param display_name: Optional display name shown in the Power Platform UI. Defaults to ``table_schema_name``.
1652+ :type display_name: ``str`` | ``None``
16501653
16511654 :return: Metadata summary for the created table including created column schema names.
16521655 :rtype: ``dict[str, Any]``
@@ -1692,7 +1695,7 @@ def _create_table(
16921695
16931696 metadata = self ._create_entity (
16941697 table_schema_name = table_schema_name ,
1695- display_name = table_schema_name ,
1698+ display_name = display_name or table_schema_name ,
16961699 attributes = attributes ,
16971700 solution_unique_name = solution_unique_name ,
16981701 )
@@ -2099,6 +2102,7 @@ def _build_create_entity(
20992102 columns : Dict [str , Any ],
21002103 solution : Optional [str ] = None ,
21012104 primary_column : Optional [str ] = None ,
2105+ display_name : Optional [str ] = None ,
21022106 ) -> _RawRequest :
21032107 """Build an EntityDefinitions POST request without sending it."""
21042108 if primary_column :
@@ -2114,12 +2118,13 @@ def _build_create_entity(
21142118 subcode = VALIDATION_UNSUPPORTED_COLUMN_TYPE ,
21152119 )
21162120 attributes .append (attr )
2121+ label = display_name or table
21172122 body = {
21182123 "@odata.type" : "Microsoft.Dynamics.CRM.EntityMetadata" ,
21192124 "SchemaName" : table ,
2120- "DisplayName" : self ._label (table ),
2121- "DisplayCollectionName" : self ._label (table + "s" ),
2122- "Description" : self ._label (f"Custom entity for { table } " ),
2125+ "DisplayName" : self ._label (label ),
2126+ "DisplayCollectionName" : self ._label (label + "s" ),
2127+ "Description" : self ._label (f"Custom entity for { label } " ),
21232128 "OwnershipType" : "UserOwned" ,
21242129 "HasActivities" : False ,
21252130 "HasNotes" : True ,
0 commit comments