Book Image

Microsoft Dynamics CRM 2011 Scripting Cookbook

By : NICOLAE TARLA, Nicolae Tarla
Book Image

Microsoft Dynamics CRM 2011 Scripting Cookbook

By: NICOLAE TARLA, Nicolae Tarla

Overview of this book

With the increased adoption of Dynamics CRM 2011, more people are faced with various tasks including administering and customizing the environment. Microsoft Dynamics CRM is a Customer Relationship Management software package from Microsoft. It offers solutions to help companies with Sales, Customer Services, and Marketing. Microsoft Dynamics CRM is increasingly being used by businesses of all kinds and all sizes to reach audiences in new ways. Microsoft Dynamics CRM scripting extends system customization through the use of client-side scripting. It builds on the standard customization options offered by Dynamics CRM."Microsoft Dynamics CRM 2011 Scripting Cookbook" walks the reader through the process of customizing an environment, from the most basic topics such as working with specific fields and types, working with the forms, and then moves on to the more advanced topics of scripting and debugging your scripts, designing new form and ribbon elements, and using additional well known public scripting libraries, as well as integrating external data sources into your environment.The first chapters of this book cover the basics of using the wizard-driven customization approach, packaging your customization into solutions, and adding basic scripts to interact with all the form elements. Further down the road we start introducing concepts around debugging your scripts, working with ribbon elements and navigation, taking advantage of other public scripting libraries and integrating them into your solutions, as well as light ways to bring social information in front of your users.Later chapters will assume knowledge of some of the most basic customizations presented at the beginning of the book. After completing the recipes in "Microsoft Dynamics CRM 2011 Scripting Cookbook", you will have gained a new perspective on how far can you take the customization in Dynamics CRM. The additional details presented around using other public scripting libraries and integrating other data sources into your environment should serve as a start into investigating additional sources.
Table of Contents (17 chapters)
Microsoft Dynamics CRM 2011 Scripting Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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.

  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.

  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.

  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.

  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:

The extended table has the following definition:

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