Portals in Dynamics 365 | Page Templates

This blog is part of an evolving series on Portals in Dynamics 365, go here to view the Introductory blog with chapters.

Page Templates in Dynamics 365 are like empty houses. During my sixth-grade summer, I remember moving into a different house across town. Looking at the new residence without any furniture or other belongings made it appear so big and vacant, and I wondered how we would fit all of our stuff inside and not have huge empty spaces. Boy, was I naive. We filled it up quickly and pondered all the numerous ways to squeeze it all in.

Empty houses have all the rooms in place with their measurements, openings, and features. Unless you remodel, you can’t do anything about that. The only thing you can do is determine the location of the couch, the table, the bookshelves, etc.

Page Templates in Dynamics 365 are the house, and the web content is the furniture. You determine what content goes in each room and how much, and the Page Template ensures that no Web Page “walls” are broken in the process.

There are many different styles of homes. There are ranch-style houses, colonial-style houses, condos, modern, and even the hottest trend of tiny houses at a whopping 400 square feet. You can also have a wide range of Page Templates. You can create one-column, two-column, and three-column Page Templates – all with varying widths. You can create Page Templates that will support an image gallery or highlight specific sections of the Web Page.

This blog will not cover a large breadth of material but will hopefully bring enlightenment to these areas:

  • Page Template Purpose
  • Rewrite vs Web Template
  • Web Templates
  • Using Website Header and Footer

Purpose of Page Templates in Dynamics 365

Page Templates provide the Portal developer the ability to focus on content and types of pages and to avoid worrying about exactly how it will look and feel once it’s displayed on the web.

When it comes to web development, it’s guaranteed you will need different types of pages to handle your various needs. For example, you want to display a list of data that has several columns; here you will need a one-column layout. On the other hand, possibly for your homepage, you want to display a myriad of information, none of it huge, but you want to keep it separated; here you might want to use a three-column layout with the two side columns of equal length and the middle column taking up 50% of the total width.

Once all of your Page Templates (rooms in the house) are created, you only have to determine the template for your Web Pages (decide where the furniture goes).

Check out PureCSS to get a better idea of various layouts and their purposes.

Rewrite vs Web Template

Page Templates fall into two different camps: those that use an ASPX page, and those that use Web Template liquid code.

List of Page Templates:

Page-Templates-in-Dynamics-365

Notice that some Page Templates have a value for “Rewrite URL” and some do not. Out of 28 default Page Templates, 17 of them are of a Type “Rewrite” that tap into an ASPX page, and the remaining ones are of Type “Web Template” that tap in Web Template liquid code.

Page Template with a “Rewrite URL”:

Page-Templates-in-Dynamics-365

Page Template without it:

Page-Templates-in-Dynamics-365

Without going into great detail, the “Rewrite URL” signifies that that particular Page Template is using a backend, unreachable ASPX page. The majority of these are used for specific purposes and cannot be used by your own custom Web Pages. For example, there is an Access Denied Page Template that displays when an unauthorized user attempts to access a Web Page of which they do not have the correct privileges. The other set of Page Templates utilize Web Templates which will be discussed next.

Web Templates

The majority of your Portal development will evolve around utilizing Web Pages that use Page Templates that are of Type “Web Template.”

These Page Templates use – you guessed it – Web Templates. Web Templates are part of Chapter 2 – Web Templates. Right now, suffice it to say that you can access Web Template liquid code and have the option to modify if necessary.

Let’s take a step back and look at the bigger picture:

Page-Templates-in-Dynamics-365

A Web Page can display an Entity List, Entity Form, or Web Form; it can also display a custom page, but we will cover that at a different time. You can have three different styles of Web Pages that all use the same Page Template. The “room” can be a bedroom, an office, or a nursery; the room stays the same, but the contents can be different or positioned differently.

Let’s take a look at some differences in the Page Templates. Full Page without Child Links Page Template:

Page-Templates-in-Dynamics-365

Here you can see the Contact form taking up the majority of horizontal space and is center aligned.

Page with Side Navigation (2 columns) Page Template:

age-Templates-in-Dynamics-365

For whatever reason, the supporting Web Template was missing from the out-of-the-box list of Page Templates and resulted in a blank area as seen above.

I had to create a new Web Template and named it “Layout 2 Column Wide Right”. After saving and refreshing, the page now shows properly.

For whatever reason, the supporting Web Template was missing from the out-of-the-box list of Page Templates and resulted in a blank area as seen above. I had to create a new Web Template and named it “Layout 2 Column Wide Right”. After saving and refreshing, the page now shows properly.

In the blank area to the left, you can add your own text by editing the Page Copy through the Portal Content Editor.

The default Page Template options are fairly thin, but that doesn’t stop you from creating your own selection of Page Templates to meet the various Portal requirements.

Use Website Header and Footer

There is one last item to discuss concerning Page Templates. “Use Website Header and Footer” seems like such an inconspicuous field – one tiny little checkbox – I mean what difference can that make, right? Huge. This field controls whether or not the Web Page will use the Microsoft HTML, including everything in the <head> section with references to JavaScript and CSS files. It includes the top navigation and the entire footer section of the Portal website.

This most likely will only surface if you decide to create your own Page Templates, but why would we do this? Great question – I’m glad you asked. I’m sure there are dozens of reasons to not use the default header and footer template pieces, but I’ll identify two.

Not too long ago, one client wanted to create a specific print-only version of a custom page. They wanted header, navigation, and footer removed. I created a custom Web Template, Page Template, and Web Page and ensured the “Use Website Header and Footer” was unchecked on the Page Template record. This stripped out all Bootstrap formatting, all JavaScript dynamics, all interfering HTML elements, and voilà, a print version page.

Another reason to avoid the default header and footer HTML is what I refer to as AJAXing your Web Template – a Chapter 2 blog. Sometimes you need to retrieve Dynamics 365 data outside of some of the standard Web Pages. With Web Templates you can do this, but you can’t have all the HTML messing with your data retrieval, specifically JSON-formatted data. Uncheck the field for that Page Template, and you’re good to go.

Now that you know the importance of Page Templates and the difference between Rewrite and Web Template types, you can begin building or utilizing existing Web Templates to create visually-appealing Portal websites.

If you have questions about using Portals in Dynamics 365, please connect with us!

26 Creative Ways Companies are Using Dynamics 365

Find out how companies like yours are using Dynamics 365 to manage their customer relationships and drive revenue.

Get The White Paper

26 Creative Ways Companies are Using Dynamics 365

Get The White Paper