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

Preface

This cookbook presents practical and quick solutions that will teach the reader how to customize Dynamics CRM 2011 with minimal effort. The client-side customizations presented in this book work in conjunction with the system customizations to cover a large scale of customizations available for your environment.

The book moves on to more advanced topics as you progress through the various recipes. While the beginning focuses on the basics of working with client side scripting, the later chapters present various solutions you can implement in your environment to help the user see the collected data in new ways.

Taking advantage of various additional client-side libraries, the customizations presented show new ways to extend your Dynamics CRM environment and achieve new levels of customization otherwise not available.

While some of these customizations do have a counterpart in using plugins, the approach presented here is targeted at system customizers and developers that look to achieve the expected results with the minimal effort and in the shortest period of time. In addition, these customizations will add minimal load to the server side, if any.

What this book covers

Each of the chapters in this book adds incremental information, and is based on the prior knowledge gained from previous chapters. For a user that has already knowledge of customizing Dynamics CRM through scripting, you can skip to the recipes of interest, or follow along and see if there is anything new.

Chapter 1, Overview of Dynamics CRM 2011 Customization, introduces the concept of solution packages, and presents the scripting model used for Dynamics CRM 2011. In addition, basic system configuration and settings that work in conjunction with your customizations are presented.

Chapter 2, Scripting Form Fields, covers the most common scripting customizations used when working with various basic form elements. We look at the various field types and how to work with these values.

Chapter 3, Field Validation, includes various validation approaches to enhance the out-of the-box validation rules. In addition, this chapter presents various approaches to presenting and collecting user input to minimize errors.

Chapter 4, Rules and Events, introduces the reader to the various events presented by Dynamics CRM 2011, as well as working with other form elements available for customization.

Chapter 5, Error Handling, introduces the concept of handling user errors, processing errors, and explains how to prevent the default system behaviors. The advanced topic shows ways to override the default system behavior with custom processing and capturing of user input.

Chapter 6, Debugging, delves into details of working with the scripts and using the available tools to handle various situations where your script misbehaves.

Chapter 7, Extended UI Manipulation, demonstrates ways to introduce visual elements to your forms to highlight form elements and also demonstrates how to handle presenting only the relevant information to a system user.

Chapter 8, Working with Ribbon Elements, is focused on working exclusively with the Ribbon. From adding and removing Ribbon elements, working with events attached to Ribbon elements, and presenting additional information on the Ribbon, most aspect of client-side Ribbon customizations are presented in an easy-to-follow way.

Chapter 9, Extending CRM Using Community JavaScript Libraries, tackles the use of external prebuilt libraries in conjunction with Dynamics CRM 2011. Some of the most popular JavaScript libraries are presented in the context on Dynamics CRM. They will either help you in writing shorter, more efficient scripts, or handle specific form actions.

Chapter 10, Light Social Media Integration, presents a few approaches to bringing information from various social media resources into your Dynamics CRM 2011 environment, with no additional load to server resources. The ways presented here are exclusively client side, and require the system user to have access to these social networks directly.

What you need for this book

In order to complete these short recipes, you will need access to a Dynamics CRM 2011 environment, either Online or On Premise. In addition, you will need a Windows PC with the latest version of Internet Explorer.

For most of these recipes, a text editor such as Notepad is good enough. Of course, using an editor such as Visual Studio will greatly enhance your experience.

Who this book is for

This book targets the new Dynamics CRM 2011 system customizers, the system administrators, as well as the developers. Whether you are new to Dynamics CRM 2011, or a seasoned system customizer or developer, some of these recipes could provide you with additional ways of solving a specific requirement, or give you an alternate approach to more extensive customizations. For developers, these recipes are aimed at showing ways in which some of the plugins can potentially be replaced by light client-side scripts.

This book can also be of value to end users, power users, and business analysts designing a new system. It will provide details on what is necessary with regards to system customization in order to achieve a specific result.

You should be comfortable with generic functionality of Dynamics CRM 2011, or a previous version. While the first chapters introduce you to some of the basic concepts around customization, you should be aware of what the application does out of the box to understand why certain customizations are necessary.

In addition, this book also caters to web designers familiar with standard JavaScript and additional libraries such as jQuery. It presents how these skills can easily be transferred to customizing Dynamics CRM 2011.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Generate a new JScript resource in your solution, named new_JSUserInput."

A block of code is set as follows:

function checkEmail(emailField)
{
   var email=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
   if(email.test(emailField))
   {
      // alert("true");
      return true;
   }
}

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: " Add the Contact entity to your solution if not already added."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.