Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Microsoft Dynamics 365 Extensions Cookbook
Microsoft Dynamics 365 Extensions Cookbook

Microsoft Dynamics 365 Extensions Cookbook: Add functionality to existing model elements, source code and finally package and deploy using DevOps

eBook
$33.99 $48.99
Paperback
$60.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Microsoft Dynamics 365 Extensions Cookbook

Client-Side Extensions

In this chapter, we will cover the following recipes:

  • Creating your first JavaScript function
  • Wiring your event programmatically
  • Writing reusable JavaScript functions
  • Querying 365 data using the Web API endpoint
  • Querying the 365 metadata services
  • Building a custom UI using AngularJS
  • Debugging your JavaScript with Edge
  • Debugging your JavaScript with Chrome
  • Unit testing your JavaScript
  • Customizing the Ribbon

Introduction

One of the greatest advantages of the Dynamics 365 suite is its web-based frontend. Users do not need a fat client installed on their machines to access the platform; a web browser is enough to access it. Most end users consider frontend user experience paramount to their day-to-day job. Dynamics 365 Sales offers a wide range of configurable extensions to enhance frontend user experience. In the previous chapter, we covered some no-code extensions; however, sometimes, customer requirements go beyond what Dynamics 365 offers out of the box. This is where JavaScript comes into the picture. JavaScript is currently the most popular web frontend scripting language. It is widely used in the industry and, thus, makes it easy for developers to pick up and start using.

Most online resources and training materials you find typically cover the bare minimum to achieve your extensions. Very few actually give you...

Creating your first JavaScript function

In this first recipe, we will set up our environment and write a simple JavaScript method that automates generation of a date field with today's date when another field is populated, using the custom Graduation Details entity created in the previous chapter. Ensure the entity has a form with the Supervisor and the Post Graduate Start Date attributes to apply our customization on it. Even though we are using the entity from the first chapter, the customization can be applied to any lookup and date field of your choice.

Getting ready

In addition to the usual access to Dynamics 365, the correct security role (System Customizer or higher), and a solution to contain your customization, it is highly recommended that developers...

Wiring your event programmatically

In the previous recipe, we wrote our first JavaScript function and wired it manually. If you are going down the custom development path, always keep in mind future maintenance tasks. Rather than wiring your events manually through the user interface, consider doing it programmatically. Not only will that reduce the manual steps to configure your extensions, but it will also give you one location to view/maintain all the event wiring.

Getting ready

In order to wire your event programmatically, you'll need a candidate function to wire (we will use the function from the previous recipe), an IDE to write your code, and, of course, access to a Dynamics 365 instance with the System Customizer or higher security role.

...

Writing reusable JavaScript functions

Fool me once, shame on you; fool me twice, shame on me!

Whenever you see yourself copying and pasting code more than once, consider refactoring your code into reusable functions. In the first two recipes of this chapter, we built single-purpose functions with hardcoded values. We can refactor our code into a collection of reusable functions.

In this recipe, we will refactor our two functions into generic ones by parameterizing them.

Getting ready

As per the previous recipe, you will need an IDE and access to a Dynamics 365 instance with the System Customizer or higher security role.

How to do it...

...

Querying 365 data using the Web API endpoint

As the Dynamics platforms evolved over the years, new features were introduced to keep the platforms modern and up to date. In older versions, the only way to communicate with Dynamics CRM programmatically was through SOAP web services. In later years, the Microsoft Dynamics product team introduced OData endpoints that greatly simplified and modernized the communication mechanism.

In this recipe, we will retrieve the list of activities associated with a contact, and then display a warning message if any of the activities are open and assigned to the current logged-in user.

Getting ready

To perform the customization, you will require access to a Dynamics 365 module along with a System Customizer or higher role. An...

Introduction


One of the greatest advantages of the Dynamics 365 suite is its web-based frontend. Users do not need a fat client installed on their machines to access the platform; a web browser is enough to access it. Most end users consider frontend user experience paramount to their day-to-day job. Dynamics 365 Sales offers a wide range of configurable extensions to enhance frontend user experience. In the previous chapter, we covered some no-code extensions; however, sometimes, customer requirements go beyond what Dynamics 365 offers out of the box. This is where JavaScript comes into the picture. JavaScript is currently the most popular web frontend scripting language. It is widely used in the industry and, thus, makes it easy for developers to pick up and start using.

Most online resources and training materials you find typically cover the bare minimum to achieve your extensions. Very few actually give you guidance on how to use modern industry standards to build enterprise-scale client...

Creating your first JavaScript function


In this first recipe, we will set up our environment and write a simple JavaScript method that automates generation of a date field with today's date when another field is populated, using the custom Graduation Details entity created in the previous chapter. Ensure the entity has a form with the Supervisor and the Post Graduate Start Date attributes to apply our customization on it. Even though we are using the entity from the first chapter, the customization can be applied to any lookup and date field of your choice.

Getting ready

In addition to the usual access to Dynamics 365, the correct security role (System Customizer or higher), and a solution to contain your customization, it is highly recommended that developers use a mature integrated development environments (IDE) to develop JavaScript. You can opt to use the out-of-the-box limited Dynamics 365 web resource editor; however, using an IDE such as Visual Studio (2015. or even the free equivalent...

Wiring your event programmatically


In the previous recipe, we wrote our first JavaScript function and wired it manually. If you are going down the custom development path, always keep in mind future maintenance tasks. Rather than wiring your events manually through the user interface, consider doing it programmatically. Not only will that reduce the manual steps to configure your extensions, but it will also give you one location to view/maintain all the event wiring.

Getting ready

In order to wire your event programmatically, you'll need a candidate function to wire (we will use the function from the previous recipe), an IDE to write your code, and, of course, access to a Dynamics 365 instance with the System Customizer or higher security role.

How to do it...

  1. Navigate to Settings | Solutions | Packt.
  2. Click on Web Resources and double-click on packt_common.js.
  3. Click on Text Edit and add the following lines of code to your library:
packtNs.graduateForm = packtNs.graduateForm || {}; 
packtNs.graduateForm...

Writing reusable JavaScript functions


Fool me once, shame on you; fool me twice, shame on me!

Whenever you see yourself copying and pasting code more than once, consider refactoring your code into reusable functions. In the first two recipes of this chapter, we built single-purpose functions with hardcoded values. We can refactor our code into a collection of reusable functions.

In this recipe, we will refactor our two functions into generic ones by parameterizing them.

Getting ready

As per the previous recipe, you will need an IDE and access to a Dynamics 365 instance with the System Customizer or higher security role.

How to do it...

  1. Navigate to Settings | Solutions | Packt.
  2. Click on Web Resources and double-click on packt_common.js.
  3. Click on Text Edit and change the populateWithTodaysDate code to the following:
packtNs.common.populateWithTodaysDate =  function(attributeToMonitor, dateAttributeToChange) 
{ 
  if (Xrm.Page.getAttribute(attributeToMonitor).getValue() !== null && 
     Xrm...

Querying 365 data using the Web API endpoint


As the Dynamics platforms evolved over the years, new features were introduced to keep the platforms modern and up to date. In older versions, the only way to communicate with Dynamics CRM programmatically was through SOAP web services. In later years, the Microsoft Dynamics product team introduced OData endpoints that greatly simplified and modernized the communication mechanism.

In this recipe, we will retrieve the list of activities associated with a contact, and then display a warning message if any of the activities are open and assigned to the current logged-in user.

Getting ready

To perform the customization, you will require access to a Dynamics 365 module along with a System Customizer or higher role. An IDE or a JavaScript editor of your choice is also recommended. To test your OData queries, consider using the CRM REST Builder solution written by Microsoft MVP, Jason Lattimer. Also, consider a REST query tool to rapidly test your queries...

Querying the 365 metadata services


In the previous recipe, we used the Web API to query data available in our Dynamics 365 instance. As we previously mentioned, the Web API is almost on par with the SOAP endpoint. This includes for querying Dynamics 365 metadata; retrieving the metadata is key to building custom frontends driven by Dynamics 365 configuration.

In this recipe, we will walk through how to query metadata associated with the contact entity to view the entity details as well as attribute details.

Getting ready

On top of your Dynamics 365 access, you will require "read" access on the Entity and Field privileges located under the Customization tab in security roles.

How to do it...

  1. Using Chrome, navigate to this URL:
[your organization URL]/api/data/v8.2/EntityDefinitions?$filter=SchemaName eq 'Contact'
  1. In a different tab, navigate to the following URL:
[your organization URL]/api/data/v8.2/EntityDefinitions(608861bc-50a4-4c5f-a02c-21fe1943e2cf)?$select=LogicalName&$expand=Attributes...
Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Customize, configure, and extend the vanilla features of Dynamics 365 to deliver bespoke CRM solutions fit for any organization
  • Implement business logic using point-and-click configuration, plugins, and client-side scripts with MS Dynamics 365
  • Built a DevOps pipeline as well as Integrate Dynamics 365 with Azure and other platforms

Description

Microsoft Dynamics 365 is a powerful tool. It has many unique features that empower organisations to bridge common business challenges and technology pitfalls that would usually hinder the adoption of a CRM solution. This book sets out to enable you to harness the power of Dynamics 365 and cater to your unique circumstances. We start this book with a no-code configuration chapter and explain the schema, fields, and forms modeling techniques. We then move on to server-side and client-side custom code extensions. Next, you will see how best to integrate Dynamics 365 in a DevOps pipeline to package and deploy your extensions to the various SDLC environments. This book also covers modern libraries and integration patterns that can be used with Dynamics 365 (Angular, 3 tiers, and many others). Finally, we end by highlighting some of the powerful extensions available. Throughout we explain a range of design patterns and techniques that can be used to enhance your code quality; the aim is that you will learn to write enterprise-scale quality code.

Who is this book for?

This book is for developers, administrators, consultants, and power users who want to learn about best practices when extending Dynamics 365 for enterprises. You are expected to have a basic understand of the Dynamics CRM/365 platform.

What you will learn

  • Customize, configure, and extend Microsoft Dynamics 365
  • Create business process automation
  • Develop client-side extensions to add features to the Dynamics 365 user interface
  • Set up a security model to securely manage data with Dynamics 365
  • Develop and deploy clean code plugins to implement a wide range of custom behaviors
  • Use third-party applications, tools, and patterns to integrate Dynamics 365 with other platforms
  • Integrate with Azure, Java, SSIS, PowerBI, and Octopus Deploy
  • Build an end-to-end DevOps pipeline for Dynamics 365

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jun 07, 2017
Length: 462 pages
Edition : 1st
Language : English
ISBN-13 : 9781786466747
Vendor :
Microsoft
Languages :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Jun 07, 2017
Length: 462 pages
Edition : 1st
Language : English
ISBN-13 : 9781786466747
Vendor :
Microsoft
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 187.97
Extending Microsoft Dynamics 365 for Operations Cookbook
$60.99
Dynamics 365 for Finance and Operations Development Cookbook
$65.99
Microsoft Dynamics 365 Extensions Cookbook
$60.99
Total $ 187.97 Stars icon

Table of Contents

11 Chapters
No Code Extensions Chevron down icon Chevron up icon
Client-Side Extensions Chevron down icon Chevron up icon
SDK Enterprise Capabilities Chevron down icon Chevron up icon
Server-Side Extensions Chevron down icon Chevron up icon
External Integration Chevron down icon Chevron up icon
Enhancing Your Code Chevron down icon Chevron up icon
Security Chevron down icon Chevron up icon
DevOps Chevron down icon Chevron up icon
Dynamics 365 Extensions Chevron down icon Chevron up icon
Architectural Views Chevron down icon Chevron up icon
Dynamics 365 Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.8
(6 Ratings)
5 star 66.7%
4 star 0%
3 star 0%
2 star 16.7%
1 star 16.7%
Filter icon Filter
Top Reviews

Filter reviews by




Leo Pham Nov 12, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Great book for any crm developer and architect. Good overview in different approaches of extending Dynamics CRM and 365. I really enjoy the "Enhancing Your Code" chapter which contains very useful & practical ideas and code samples even with 3 layers approach but you can extend it to a DDD (Domain-Driven Design).As I really were reading and enjoying the book. I have double-checked and found out that Rami Mounla was awarded the Microsoft CRM MVP in 2015.
Amazon Verified review Amazon
Juan Carlos Aguilar Oct 19, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
interesting
Amazon Verified review Amazon
BERNARDO A CETZAL IX Oct 06, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Contenido directo sin tanto rodeo, facil de seguir para realizar pruebas de concepto.
Amazon Verified review Amazon
Jeremiah Bullfrog Mar 08, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
As a Dynamics CRM developer with a decade of experience, starting with CRM 4.0, this is the first book I have found that is written at a code-based (incl. SDK) "developer level."The JavaScript uses the old Xrm.Page model, but that constitutes a small part of the book and can easily be translated into the new executionContext/formContext-based code used by the newer Customer Engagement (9.x) version.The examples given are at exactly the right level of detail and complexity to demonstrate the proof of concept for each digestible-sized "recipe." And more than just a cookbook of unrelated recipes, the proof-of-concept components accumulate into near real-world examples of things like integration with the Azure Service Bus.The chapter on "Refactoring your plugin using a three-layer pattern" is especially excellent, and essential knowledge for doing unit-testing of plugins (via Moq and XrmUnitTest, with examples of each being given in the book).The second half of the book contains much less code (aside from a few PowerShell scripts), covering subjects like security roles, solutions, deployment, Power Apps, Power BI, Flow, and the Common Data Service.The text contains a few minor typos, but they don't distract from understanding the material.Overall, this is an excellent (and perhaps the only?) book to introduce the intermediate Dynamics CRM developer to code-based functionality and possibilities that exist on the next-higher level of expertise--including some insights into the "under the hood" behaviors of CRM, gleaned from using SQL Server Profiler on an on-premise installation; and links for specific further exploration online in the free MSDN/TechNet documentation provided by Microsoft, which can be a bit overwhelming if you have no particular place to start.It's not an inexpensive book, but it's totally worth the investment if you're in the target audience. I'm delighted to have found it, and expect to be referring to it regularly in the future.
Amazon Verified review Amazon
Nived Varma Jun 07, 2018
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
The book is very haphazard. Many technical mistakes are there. The explanation is just surface level. Recipes are not tested. The quality of code is just Hello world examples. Selection of example is very poor.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.