How to Upload a Custom Javascript Web File in PowerApps Portal?

How to Upload a Custom Javascript Web File in PowerApps Portal?

Nikita Rohira

October 26th, 2021

PowerApps support web files. You can upload custom images, files, spreadsheets, and more. But when it comes to javascript files, it shows an invalid file type error.

The reason is that web files are notes with attachments. These notes are stored in the dataverse or the Dynamics instance. As for .js extension files, they are mostly blocked from upload due to security issues. Even if it’s possible to upload and open .js files, you shouldn’t, for the same security reasons.

If you want to upload a custom javascript file, here’s what you should do:

→ Log in to the portal with the administrator role.

portal with the administrator role

→ From the portal editor box, click on New -> Child File.

Child File

→ Create a new child file pop-up will open.

child file pop-up

→ Click on the Upload file option and choose the .js file from file explorer.

→ Select the attachment option in Content-disposition and click on save.

→ Click on the portal editor box -> Children to view the uploaded file.

Children to view the uploaded file

You can also view the uploaded .js file in the Dynamics CRM customer portal management app in CRM.

→ To view uploaded .js files, go to Portal Management App -> Web Pages.

→ Open the web page from where you have uploaded the file.

Portal Management App Web Pages

→ Click on Child Files & search uploaded file.

Child Files and search uploaded file

→ You can see the uploaded file in the file record or notes as a note attachment.

note attachment

→ If note attachment is not found, or you get the below error while uploading a .js file in notes, then check blocked file extensions in CRM.

note attachment is not found

→ To verify/allow .js file extension in CRM, go to Settings -> Administration -> Click on System Settings.

Click on System Settings

→ In General Tab -> From Set blocked file extensions for attachments list, check & remove .js file extension and save it.

Set blocked file extensions for attachments list

Whenever you upload a web file, it is uploaded as a note attachment in your CDS/Dynamics 365 environment, and more often than not, it is not a comprehensive solution.

But from now you can use uploaded .js globally by adding js reference in pages with below script reference.

< script type="text/javascript" src="~/sample.js" >< /script >

Note: My web file is under the Home page, and hence I have used the path accordingly. However, if your path is different, you may need to change the src value accordingly.

I hope you found this article helpful. Stay connected to know more about the Dynamics CRM customer portal.

 

All product and company names are trademarks™, registered® or copyright© trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.

Read Related Blogs About Portal Solutions

Improve Customer Experience with Ecommerce Portal Development

Improve Customer Experience with Ecommerce Portal Development

7 Min
How CX has Changed in 2021

How CX has Changed in 2021

5 Min
Why You Should Use Dynamics 365 WordPress Portal

Why You Should Use Dynamics 365 WordPress Portal

5 Min
To Top