Creating and managing entities

In this recipe, we'll go through the process of creating a new entity, look at how to configure such an entity, and in the end, how to clean up an entity that's not required in our solution package.

All customizations in this book are created as part of a solution. As such, we will be reusing the previously created solution.

Getting ready

In order to proceed, log in to your existing Dynamics CRM 2011 instance and navigate to the solution we created previously.

How to do it...

In the created solution package, we will be adding a new entity to store a list of all countries. We want this listing to be manageable by a user with proper permissions, so that it can be updated as they do business with new countries.

  1. Open the solution, and navigate to the Entities tab.
    How to do it...
  2. Click on New to add a new entity to the solution.
  3. Fill in the mandatory fields, and define where this entity will be visible. In our case, we will make this entity visible only in the Settings area. We are setting the Ownership of this entity to Organization, thus making it available across the environment.
    How to do it...
  4. Additionally, the Options for Entity section allows you to define some of the standard elements and behaviors that can be included with the entity. These are comprised of behavioral settings, data settings, and configurations for mobile and Outlook. These settings give you a granular access to configure how an entity can interact with the system and other entities, what processes can be run against this entity, and storage options for related files.
    How to do it...
  5. Before clicking on the Save icon, direct your attention to the second tab named Primary Field. All entities will need to have a primary field, and we can define the properties of such fields on this tab. We will define the display name as Country, leave the Requirement Level with the default value Business Required, and the Type as Single Line of Text.
    How to do it...
  6. Now we click on Save.
  7. Once the entity is created, additional options to edit Forms, Views, Fields, and Relationships become available.
  8. Great job! Now we have the entity created and we can start working with it.

Removing an entity that is not being used by our customization is again a relatively simple task.

  1. In our solution package, select the entity.
  2. Click on the Delete button.

Tip

If the entity does not have any remaining associations with other entities in the system, it will be removed. Otherwise, a message will prompt you, and additional information is provided to help in identifying what relationships are preventing you from deleting this entity.

How it works...

Each entity is stored in the database as a set of two tables. The first one stores the base entity, while the second one stores the customizations to the entity. Creating a new entity in fact creates this set of tables, one that stores the entity generic properties, and another that stores each data fields defined. So, in our case, we will have a table called new_countryBase, and another called new_countryExtensionBase, as seen in the following two images:

How it works...

The extended table has the following definition:

How it works...

This information is only available while working On-Premise. With a Dynamics CRM 2011 Online instance, there is no direct access to the database.

Making modifications directly to the database in Dynamics CRM 2011 is not supported. This can cause various issues. All data access should go through web services. When creating custom reports, use the views. They also present the trimmed data security.

See also

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.97.109