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
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Microsoft Dynamics CRM 2016

You're reading from   Mastering Microsoft Dynamics CRM 2016 An advanced guide for effective Dynamics CRM customization and development

Arrow left icon
Product type Paperback
Published in Nov 2017
Publisher Packt
ISBN-13 9781786466617
Length 402 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
Deepesh Somani Deepesh Somani
Author Profile Icon Deepesh Somani
Deepesh Somani
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. History of Dynamics CRM FREE CHAPTER 2. Working with Sales 3. Working with Services 4. Working with Marketing 5. Working with the XRM Framework 6. Analytics with CRM 7. Workflow Development with Dynamics CRM 8. Client-Side Scripting 9. Enhancements for Mobile 10. Plugin Development with Dynamics CRM 11. Business Process Flows and Business Rules 12. New Features in CRM 2016

Scenario 4


Rob is a CRM developer in an organization; he comes across a requirement that needs him to deactivate the Contact form if the parent account status is inactive. He figures he can use JavaScript to solve this problem. We will make a Web API call for the account to check its status and then deactivate the form using a JavaScript function.

First, we will retrieve the statuscode field of the parent account. Then, we need to check if the status of the parent is inactive; if yes, then we need to deactivate the form. We will write a JavaScript function for this. The whole process is shown in the following code:

function checkAccountStatus()
{
  //Fetch parent account
  var accountAttribute = Xrm.Page.getAttribute("parentcustomerid");
  var accountId;

  //Check if account is not null
  if (accountAttribute != null)
  {
    //Get value of account attribute
    accountId = accountAttribute.getValue();
    if (accountId != null)
    {
      //Gets the account Id
      accountId = accountId...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image