This topic shows how to programmatically create a custom user-owned table called Bank Account and add four different types of columns to it.
You can also create organization-owned custom entities. More information: Table ownership
See How to run samples for information about how to run this sample.
The CreateEntityRequest
message is intended to be used in a scenario where it contains the data that is needed to create a custom table, and optionally, to add it to a specified unmanaged solution.
In order to simulate the scenario described in What this sample does, the sample will do the following:
Checks for the current version of the org.
- The
createrequest
method creates the custom table. - The
CreateEntityRequest
method is used to define the table. - The
StringAttributeMetadata
method defines the primary column of the table. - The
CreateBankNameAttributeRequest
method creates a string column to the table. - The
CreateBalanceAttributeRequest
method creates a money column to the table. - The
CreateCheckedDateRequest
method creates a DateTime column to the table.
Display an option to delete the records created in the Setup. The deletion is optional in case you want to examine the entities and data created by the sample. You can manually delete the records to achieve the same result.