Dynamics 365 Application Development

4.8 (5 reviews total)
By Deepesh Somani , Nishant Rana
    Advance your knowledge in tech with a Packt subscription

  • Instant online access to over 7,500+ books and videos
  • Constantly updated with 100+ new titles each month
  • Breadth and depth in over 1,000+ technologies
  1. Customize Application Navigation

About this book

Microsoft Dynamics 365 CRM is the most trusted name in enterprise-level customer relationship management. Thelatest version of Dynamics CRM comes with the important addition of exciting features guaranteed to make your life easier. It comes straight off the shelf with a whole new frontier of updated business rules, process enhancements, SDK methods, and other enhancements.

This book will introduce you to the components of the new designer tools, such as SiteMap, App Module, and Visual Designer for Business Processes. Going deeper, this book teaches you how to develop custom SaaS applications leveraging the features of PowerApps available in Dynamics 365.Further, you will learn how to automate business processes using Microsoft Flow, and then we explore Web API, the most important platform update in Dynamics 365 CRM. Here, you'll also learn how to implement Web API in custom applications. You will learn how to write an Azure-aware plugin to design and integrate cloud-aware solutions. The book concludes with configuring services using newly released features such as Editable grids, Data Export Service, LinkedIn Integration, Relationship Insights, and Live Assist.

Publication date:
January 2018
Publisher
Packt
Pages
418
ISBN
9781788399784

 

Chapter 1. Customize Application Navigation

A site map can be defined as a set of links through which a user can navigate and find their way around the website. In Dynamics 365 and in its earlier version, a site map is an XML file that is used for defining the navigation of the application or specific app module for the users. Until CRM 2016, there had been only one site map file for an organization. With the advent of apps in Dynamics 365, now we have one site map file for each of the app modules. As far as customizing the site map was concerned, until now we had to either update it using XML Editor, a text editor or some third-party tools. However, with Microsoft Dynamics 365 we have the built-in Site Map Designer in the product itself. This designer allows the administrator, customizers, or users with appropriate privileges to easily define navigation for an app by simply adding, dragging, and dropping the components within the Site Map Designer canvas. In this chapter, we will be covering the following points:

  • Overview of the site map in Dynamics 365
  • Understanding the designer interface and its components—areas, group, and sub areas
  • Common operations that can be performed on the site map
 

Overview of the site map


For every app that is configured, we will have a separate site map defined for it. By default, we will have a Dynamics 365 custom app configured during the set up of the Dynamics 365. We can also have other apps configured while provisioning the Dynamics 365 instance such as Sales, Field service, Project service automation, or Customer service, if we have opted for them while provisioning Dynamics 365. For now, let's try to understand the basics of using the Site Map Designer using Dynamics 365 for a Sales app. Suppose we have selected Sales while provisioning Microsoft Dynamics 365, shown as follows:

Note

The link for the Dynamics 365 Trial with Enterprise Plan 1 can be found here: https://signup.microsoft.com/Signup?OfferId=bd569279-37f5-4f5c-99d0-425873bb9a4b&dl=DYN365_ENTERPRISE_PLAN1.

This will provision Dynamics 365 with a Sales app. This is how the navigation will look for the Sales app:

Now, as we have covered the basics of site map, let us look at the Site Map Designer interface and what components it has and how we can use it to update our site map for sales.

Overview of Site Map Designer

To access the Site Map Designer for our Sales app, perform the following steps:

  1. Log in to the Dynamics 365 Sales app with a user having System Customizer, System Administrator, or any appropriate security role to customize the site map.
  2. Go to SettingsSolutions.
  3. Create a new solution with the appropriate details. For example, we have created a solution with the name of Site Map Solution, the publisher as default publisher, and the version as 1.0.0.0.

Note

We can also log in to the default Dynamics 365 - custom app and create a new solution and add the Sales App Site Map in it.

  1. Click on Client Extensions and add Sales App Site Map in it, shown as follows:

Note

We can go to Settings | Customizations and update the site map in the default solution as well. However, as a best practice, we should create a separate solution and add the required components that need to be customized in it.

Double-clicking on it will open the Sales App Site Map on the Site Map Designer for us to edit. The Site Map Designer canvas allows us to work with Area, Group, and Subarea components:

Within the designer canvas, we can Add, Cut, Copy, Paste, Clone, and Delete.

Let us look at these components in detail.

Understanding components in the site map

Site map consists of three main components:

  • Area: Area can be defined as the main node or area inside the navigation pane that consists of groups and their corresponding subarea. A new area can be added or the existing area can be updated or deleted. If an area doesn't consist of any visible subarea, the area will be hidden.
  • Group: Groups can be defined as a collection or group of subareas. Just like an area, a new group can be added or an existing group can be updated or deleted.
  • Subarea: A subarea can be defined as a navigation link within the area that defines what should load inside CRM's main pane when clicked. The subarea can point to a dashboard, an entity, a URL, or a web resource. Just like area and group, a new subarea can be added and an existing subarea can be updated or deleted.

Referring to our Sales app interface:

  • Sales, Marketing, Settings, and Training are termed as areas
  • My Work, Customers, Sales, Collateral, Marketing, Goals, and Tools are groups within the Sales area
  • Dashboards, What's New, and Activities are subareas inside the My Work group.

The Sales area would have subareas specific to Sales, arranged inside what are termed as groups. Similarly, the Marketing, Settings and Training Area will have corresponding subareas inside the corresponding group. As shown in the following screenshot, the Marketing Area has Dashboards, Activities, Accounts, Contacts, Leads, Marketing Lists, Campaigns, Quick Campaigns, and so on. It also has subareas specific to the marketing module. These subareas are arranged inside the My Work, Customers, Marketing, Collateral, and Tools groups:

Now, as we have got the overview of the site map components, let us look at the different properties of each of these components in the next section.

Getting to know the area, group, and subarea properties

Let us look at the different properties of these components before we start customizing our Sales app navigation.

  • The area component comprises of following properties:
  • Group component shares most of the same properties as Area:

Note

Set as Profile property of Group might not be relevant for Dynamics 365, as the Workplace area has been discontinued starting CRM 2013.

Subarea has few more properties compared to Area and Group:

  • As we know that the site map is basically an XML file, any changes that we are doing through Site Map Designer are basically updating the site map's XML behind the scenes:
  • To get the Sales App Site Map definition, export the solution containing the Sales App Site Map client extension and unzip it. Then, open the customizations.xml file and search for the SiteMap tag.
  • The following is the sample XML for the My Work group of the Sales area inside the Sales App Site Map. We can see the Area, Group, and SubArea tags along with their corresponding attributes:
  • As mentioned earlier, instead of using the Site Map Designer, we can manually update the site map's XML using any text editor, and can import back the solution (and publish it) to see the changes.

In this section, we looked at the properties of the area, group, and subarea components of Site Map Designer. In the next section, we will learn how to perform some basic operations such as updating, adding, deleting, and so on, on these components through Site Map Designer.

 

Common operations using Site Map Designer


Now, as we have gone through all the properties of the components of site map in detail, let us see how we can perform some common operations using Site Map Designer.

Editing an existing component in the site map

To edit an existing area, group, and subarea in the site map, we need to select that component in the designer and go to the properties tab of that component. Let us take a simple example to understand this. Suppose we want to rename the existing Training area to Help, we need to select the Training area on the site map, go to its Properties tab, and update its Title property.

Let us specify Help as the value for the Title property. This updates the area's title from Training to Help, as shown as follows:

We can also update the title property of the site map components through inline editing. For this, hover over the component to reveal the pencil. We can click on the pencil icon to edit the Title. Similarly, we can edit or update the corresponding properties of the group and subarea components, and as we mentioned earlier, any changes made in the designer will reflect back in the XML for the site map.

Adding a component to the site map

To add an area, group, or subarea to the site map, we need to click on the Add button on the Action Bar in the Sitemap Designer. Let's add an area here to understand this. Click on the Add button and select Area:

Or, drag-and-drop the Area from the Components tab.

Once added, we need to select the component (Area here), and then edit its properties in the Properties tab. For example, the Properties tab for the new Area component added is shown in the following image:

This will add a new Area named New Area in the site map.

Similarly, we can add or drag and drop new groups and subarea components in the Navigation and specify their properties.

Cutting, copying, and pasting a component to the site map

Through Site Map Designer, we can also cut, copy, and paste site map components. Let's select our New Area and click on the Cut button on the Action Bar to cut the component. The component will be grayed out.

Similarly, we can select the component and click on the Copy button to copy the component. The Paste button gives us the option of pasting the component to the right or left in case of Area and Group components, shown as follows:

Cloning a component to the site map

To clone or make a copy of an existing Area, Group, and Subarea to the site map, we can select the component and click the Clone button on the Action Bar in the Sitemap Designer. The clone will add the respective component to the next component being cloned with the -Copy suffix added to its Title. For example, cloning the Sales Area, as shown in the following image, will add a new area named Sales-Copy next to the Sales Area that is cloned:

Deleting a component from the site map

To delete an Area, Group, or Subarea from the site map, select the component and either click Delete from the Action bar or press the Delete key:

Deleting an Area will also delete the Group and Subarea in it. Similarly, deleting the Group will delete the Subarea in it.

Organizing a component within the site map

Using Drag and Drop, we can move the components around the site map before we rearrange it:

For example, we can move the Sales Area to be the last Area in the site map, My Work to be the second group within the Sales Area, Dashboard as the last Subarea inside the MyWork Group, and so on, shown as follows:

We can also move a Subarea to a different Group. For example, the Dashboards Subarea can be moved to any of the other Groups such as Customer, Sales, Collateral, and so on, and a Group to be part of a different Area. That is, we can move the My Work Group to be part of the Settings, Training, and Sales area.

Saving, validating, and publishing changes in the site map

To reflect any of the preceding changes for the users, such as add, clone, delete, and so on, we need to click Save and then Publish it in the Site Map Designer canvas. Here, *Draft indicates that there are unsaved changes:

On saving the changes and clicking on Publish, it changes to Published to indicate that changes have been applied and are available for the users to see:

Clicking on the Save button will also validate and show up if there are any errors in the site map. For example, if we have not provided values for any of the required fields or specified unallowed characters for any of the properties. In the following screenshot, we have not provided a value for the entity property in the Subarea and clicked on Save, which is a mandatory field:

This shows the ERROR MESSAGE notification in the designer with all the details. We will only be able to save and then publish the changes after fixing the error.

Adding a Subarea component in the site map

Let's take a simple scenario here to understand how we can add a new Subarea component. We realize that our Sales app users would be frequently accessing the Open Leads View inside CRM, so it would be helpful for them if we could add a Subarea for Open Leads View in the My Work Group in the Sales Area for them. To implement it, we will need to add a new Subarea inside the My Work Group of type URL. To do so, we need to click on Add in the Action bar in Sitemap Designer and add a new Subarea and drag and place it below the Activities SubArea in the My Work Group:

Here, the URL pattern for the view needs to be the following:

=/_root/homepage.aspx?etc=<entity code >&viewid=%7b<GUID value of view id>%7d"

For the etc and viewid query parameters, we need to go to the Open Leads view in CRM and click on the EMAIL A LINK| Of Current View ribbon button to get the link:

The link will have the value of etc and viewid. We will then copy the value of the etc and viewid query string parameters from the link. We can then set the properties for our new SUB AREA, shown as follows:

We will save and then publish it. After publishing, inside the Sales app the user will be able to see the new Subarea named Open Leads:

Clicking on the Open Leads Subarea will open the Open Leads view, shown as follows:

Hiding a Subarea component in the site map

As we saw earlier, the Subarea component has a privilege property. It defines whether to show or hide the Subarea based on privileges the user has through the security roles assigned. Let us try to understand this with an example as well. Suppose we want to show the Open Leads Subarea we just added to only those users who have a Create privilege on the Lead entity. To define this, let us go back to the Properties tab of the Open Leads Subarea in Site Map Designer. There, we need to go to Privileges inside the Advanced section. Inside the Entity drop-down, we can select the Lead entity and click on the + (plus) button to add the record. We will leave all the checkboxes unchecked, except Create:

Save and publish the changes. Now, let us log in with the user that has only the Salesperson security role assigned. Here, we have updated the security role and have set None for Create Privilege on Lead Entity; that is, the first option that we see in the following screenshot:

The users who do not have the Create privilege on the Lead record, will not be able to see the Open Leads Subarea in their site map. 

Passing parameters to a URL from the site map

As we saw earlier, the Subarea component has a Parameter Passing checkbox property. It specifies whether to pass information about the organization and language context to the URL. The property is only available for Subareas of type web resource or URL. Suppose we have the following URL defined in our URL property of Subarea:http://mydomain/mypage.aspx.Checking the Parameter Passing checkbox will pass the following parameters to it:http://mydomain/mypage.aspx/?orglcid=1033&orgname=org29d341dd&userlcid=1033.

  • orglcid: language code identifier of the base language of the organization
  • orgname : unique name of the organization
  • userlcid: language code identifier used by the current user

This information could be used to create solutions that support multiple languages.

Note

Creating solutions that support multiple languages is detailed at https://msdn.microsoft.com/en-us/library/hh670609.aspx#Anchor_0.

 

Editing the site map and support for clients


Let us look briefly at separate ways of editing the site map apart from Site Map designer and the ways in which clients are supported for the different type of site map that we now have in Dynamics 365.

Site map editors

A site map, as we essentially know, is an XML file. Any XML text editor is good enough to edit site map XML files. For this, we can export the unmanaged solution that contains the site map XML, edit it either in NotePad, Visual Studio, or any other XML editor, and import it back. The important thing to remember here is, if we are importing the site map as a managed solution, it will create a new site map record with all the latest changes, and in the case of unmanaged, the existing site map XML is overwritten.

Note

Editing the site map XML with schema validation is detailed at https://msdn.microsoft.com/en-us/library/gg334493(v=crm.8).aspx.

Apart from Site Map Designer, we can use one of the third-party site map editors to edit the site map. One of the most popular tools is site map editor that is included as part of the XRM Tool Box. This is how our Sales App Site Map loads up inside site map editor:

The tool makes it easy to edit the site map compared to editing the XML manually. The tool has been one of the most popular tools for editing site maps and has been available since CRM 2011. The tool has been recently updated to support multiple site maps available in Dynamics 365. The other option is programmatically updating the site map. For this, we can make use of the site map entity and update its sitemapxml property, shown as follows:

  • Create an object of the site map entity:
Entity siteMap = new Entity["sitemap"]; 
  • Update its sitemapxml property with valid XML:
siteMap["sitemapxml"] = "valid site map xml"; 
  • Update the entity using Organization Service's instance:
service.Update(siteMap); 
  • Publish the changes using the PublishXmlRequest class:
PublishXmlRequest request = new PublishXmlRequest();
 request.ParameterXml = "<importexportxml><sitemaps><sitemap></sitemap></sitemaps></importexportxml>";
 service.Execute(request);

We can also create and delete app-specific site map records programmatically. However, it is recommended you use Site Map Designer instead of doing it programmatically. Another point to note is that the default site map record cannot be created or deleted.

Note

It is strongly recommended that we export the existing site map XML file and save a copy of it before we start editing, which can help us to restore it back in case of any errors while editing.

Supported clients

The default site map, which is the site map for Dynamics 365 – custom app is supported for both Dynamics 365 web applications and Dynamics 365 for Outlook. The site maps for any new custom apps, or the business apps such as Sales, Customer Service, Field Service, and Project Service Automation, are only supported by Dynamics 365 web applications.

 

Summary


In this chapter, we saw how the site map has evolved in Dynamics 365. Now, we can have multiple site maps per app and the built-in Site Map Designer tool in the product itself. We also had a detailed look at the new Site Map Designer and some common operations that can be performed through it. In the next chapter, we will cover the new Visual Process Designer and how it can be used to create business process flows with intuitive drag and drop capabilities.

 

 

About the Authors

  • Deepesh Somani

    Deepesh Somani is a Microsoft Dynamics CRM architect/practice lead at Dynamisity and a corporate trainer. He has been a Microsoft MVP awardee since 2015 and was recognized as one of the top 50 CRM bloggers in 2019 by Feedspot. He has developed 14 free tools with 7,000 downloads and a Learning Dynamics CRM app with 1,500 downloads and 4.4 rating on the Play Store. He is experienced in working in different domains with teams from many countries and multinational companies and has authored two other Packt books.

    Browse publications by this author
  • Nishant Rana

    Nishant Rana is a Microsoft MVP – Business Solutions (Dynamics 365) with over 10 years of experience in Microsoft Dynamics CRM, Microsoft SharePoint, and other Microsoft .NET technologies. He has worked as a consultant at Microsoft for 7 years. He is a Microsoft Certified Professional in Microsoft Dynamics CRM, SharePoint, and Azure .NET. He is also a technical reviewer of popular books on Microsoft Dynamics CRM. He is an avid blogger and is also the author of Nishant Rana's Weblog, a technical blog on Microsoft.NET technologies, which has had more than 2.5 million hits and has 1,000 followers.

    Browse publications by this author

Latest Reviews

(5 reviews total)
The book itself isn't that helpful. I'm looking around for books that have lots of quick 'mini-projects' with Microsoft Dynamics. I want something that will give me LOTS of repetition going navigating the interface and solving simple problems. But there doesn't seem to be anything out there. Nevertheless, the shopping experience is always convenient with Packt.
Contents are relevant and easy to.understand
Good knowledge presentation.

Recommended For You

Book Title
Unlock this book and the full library for FREE
Start free trial