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
₹799.99 ₹3634.99
Paperback
₹4542.99
Subscription
Free Trial
Renews at ₹800p/m

What do you get with a Packt Subscription?

Free for first 7 days. ₹800 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
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 : 9781786464170
Vendor :
Microsoft
Languages :
Concepts :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. ₹800 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

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

Packt Subscriptions

See our plans and pricing
Modal Close icon
₹800 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
₹4500 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 ₹400 each
Feature tick icon Exclusive print discounts
₹5000 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 ₹400 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 14,001.97
Extending Microsoft Dynamics 365 for Operations Cookbook
₹4542.99
Dynamics 365 for Finance and Operations Development Cookbook
₹4915.99
Microsoft Dynamics 365 Extensions Cookbook
₹4542.99
Total 14,001.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

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.