cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Geradav
Advocate II
Advocate II

powerapps portal - custom javascript

Hi,

 

I am using Bootstrap Studio to create a web page for a PowerApps Portal and I am using some accordion component. It requires some JavaScript and I am not so sure how to make it work in the Portal of PowerApps. I know there is a Custom JavaScript section in the Web Content of a Web Page in the Portal Manager, but I haven't had much success in making the accordion work.

Anyone would know how to make it work?

 

Thanks

6 REPLIES 6
v-siky-msft
Community Support
Community Support

@Geradav 

 

Could you describe more detail with your issue?

Please refer to the following about how to write javascript to Portal webpage.

https://www.cloudfronts.com/using-javascript-write-d365-crm-portals/ 

If this still doesn't make sense, please share more information.

Sik

Thanks @v-siky-msft 

That confirms what I thought.

 

I use Bootstrap Studio to generate web content for the Portal. It creates several JavaScript and CSS files. Integrating multiple CSS files in the Portal is fine. I was hoping we could do the same with JS files. Not sure I can put all the content of all the JS files in the "Custom JavaScript" field.

I opted for hosting the files externally in a publicly accessible library and redirecting the scripts to that location.

So far the portal works fine, but not sure what JavaScript code is used or not used.

 

Power Apps Portal being a low-code/no-code environment I was hoping I could just drag and drop files generated by a third party application into the "web files" folder and having it work beautifully.

@Geradav 

 

If you want to include JavaScript from your CRM instance, you need to upload as a web file. You can't easily include JavaScript that is uploaded as a Web Resource.

- Create a web file for your JavaScript, and upload the note for it. If you are not able to upload the JavaScript file for any reason it is likely that the extension is blocked from being uploaded. You will then need to go to System Settings, and remove the .js from the list of blocked extensions.

- In Content Snippets, create a new content snippet called Tracking Code, which will be included in the master page of the site. Add the script tag to the Tracking Code content snippet in the following way:

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

Hope this helps.

Hi @v-siky-msft 

 

Thanks for your message.

I haven't yet tried, but your reply corresponds exactly to my scenario and what I was looking for.

 

Thanks

Best regards

@v-siky-msft 

 

Does a separate content snippet need to be created for each javascript file?

 

When you state to add a "script tag" to the content snippet are you referring to the value field?

 

Does the web file uploaded need to be named "internal.js"?

 

Thank you for the help!

Anonymous
Not applicable

@AutoEgoSS - no, you can create just one content snippet and add all of your JS there. (it's better to have multiple and just add the snippet where is needed). 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Users online (68,784)