ENGINEERED CODE BLOG

Where’s That Dynamics 365 Portals Code? – Part 3

In my previous blog post, I talked about looking at the page-specific attributes like Copy, Summary, Custom JavaScript and Custom CSS when you’re searching for where the code is being saved. In this post, I will touch on a few other places, such as Entity Forms, Entity Lists, Web Files and Content Snippets.

Entity Forms, Entity Lists and Web Forms

Similar to Web Pages, the Entity Form, Entity List and Web Form Step entities have a Custom JavaScript field (schema name is adx_registerstartupscript). Code in this attribute will typically be automatically included within a <script> tag. Please note that while normally these fields do support Liquid, there are some exceptions to that for the Entity List – it depends on how the Entity List is included on the page. I’ll get into those details in a future blog post, but for now just be aware that in some cases you may find that the Liquid code is not evaluated when you include it in the Custom JavaScript field on an Entity List.

Now, of course for the Custom JavaScript to appear on the page, so must the Entity List, Entity Form or Web Form. Entity Lists, Entity Forms and Web Forms must be included by the Page Template – they are not automatically included. This can be done by using one of the out-of-the-box Page Templates, or by using Liquid to include them. Note that if you create a custom Entity List implementation, such as what’s suggested here, the Custom JavaScript won’t automatically appear on the page, as you are essentially taking over full control of rendering the Entity List.

Code Included via a Web File

Another place you may find code is uploaded as a web file. This is a common technique used when overriding the out-of-the-box Bootstrap theme. It is perfectly acceptable to upload a JavaScript or CSS file to a web file, and include a reference to that file on a page. Like a Web Template, there are many different places that could include a web file in this manner. Also keep in mind that files hosted elsewhere can also be included in a portal (for example, external JavaScript libraries) in the same way.

Content Snippets

Think of Content Snippets as something similar to Web Templates. In fact, it would have been interesting to have been involved in the conversations when Web Templates were invented, as I’m curious as to why they didn’t use Content Snippets as they could serve the same purpose. I’d understand if they simply wanted to keep things separate, but I’ve always been curious if there was more too it than that.

Content Snippets let you include HTML, JavaScript, CSS and Liquid, and you can easily reference Content Snippets from other areas, such as Web Template or Web Page Copy attributes. So if you’ve looked everywhere else without any luck, that code you’re looking for may just be in a Content Snippet.

So, Where is the Code?

We’ve look at the usual suspects when it comes to put our Portals code somewhere, including:

  • Web Templates, including for the Header, Footer, and Page Template
  • Copy, Summary, Custom JavaScript and Custom CSS attributes on the Web Page
  • Custom JavaScript attributes on Entity List, Entity Form and Web Form Step
  • Web Files
  • Content Snippets

Where else are people putting their Dynamics 365 Portals code? Let me know in the comments!

In the last post in the series, I’ll give my recommendations on where I think you should be putting your code.

One response to “Where’s That Dynamics 365 Portals Code? – Part 3”

  1. […] post Where’s That Dynamics 365 Portals Code? – Part 3 appeared first on Engineered […]

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact

Engineered Code is a web application development firm and Microsoft Partner specializing in web portals backed by Dynamics 365. Led by a professional engineer, our team of technology experts are based in Regina, Saskatchewan, Canada.