| Mustafa Usmani

Recently while working on Power Portals, I came across something unusual. While uploading my code on one of the Web Pages that I was working on, I got an error message saying;

"You have exceeded maximum number of 65536 characters in this field".

For the time being I placed all my JS code in the custom JavaScript dialog in the advanced section of the Web Pages (although it is always a good practice to keep your JS scripts separate from your HTML code. But shortly after I came to know that there is also a character limit on the Custom JS section as well which is of 100,000 characters. So, in this blog we will be looking at how we can minimize this error and how we can make our code more modular.

Now the reason we will be looking on how we can minimize this error is because, as of right now we cannot disable maximum character limit on Power Portals and I think we won't be getting any sort of option in the future as well due to the fact that Power Portals provides with few options that we should use. Those options are as follows:

Content Snippets

MaximumCharacterLimit

Inside our Content tab we have Content Snippets and this acts like a component for your page which you can use anywhere in your page. For example, you want to display a message whenever some condition occurs, so you can make a snippet of the message, as shown below:

MaximumCharacterLimit

And after making that snippet, you can easily include that snippet in your page wherever you want to. The procedure of adding the snippet is as follows:

{% include 'snippet' snippet_name: ‘Account/Conversion/PageCopy ‘ %}

Web Templates

Web Templates are also a great way to reuse your code in various pages. They are a bit different from the Content Snippets but works on the same principle. Personally, I prefer Web Templates more as they output whatever you have written as is it in your page. For example, due to max character limit on a custom JS, I converted my functions that I was using into Web Templates and was even able to use them in other pages as well.

MaximumCharacterLimit

The way of including web templates in your Web Pages is as follows:

{% include 'getFileContents' %}

Join us next time, as we continue our journey of learning canvas apps.Click here to learn more about Imperium's Power Apps Services. We hope this information was useful, and we look forward to sharing more insights into the Power Platform world.



About The Blog

Stay updated with what is happening in the Microsoft Business Applications world and initiatives Imperium is taking to ease digital transformation for customers.


More About Us

We provide guidance and strategic oversight to C-Suite and IT Directors for on-going implementations. Feel free to give us a call.

1 331 250 27 17
Send A Message

Ready to Start?

Get a personalized consultation for your project.

Book a Meeting