Dynamics 365 Configuration and Customization. Power App Portal Development, Power Platform development, Azure development, C#.Net, JavaScript, jQuery, SQL Server etc.
What is Site Marker and How to use Site Marker?
How to use JavaScript Web File in Portal?
How to use JavaScript Web File in Portal?
Web file use to store images, .json type file, .js type file, documents and other file types. These attached files can be downloaded.
When the files are attached, it is accessible by code written in Web Template, Page Template or other codes.
When you go to the portal, you will find already some web files added to portal. The file like bootstrap.js, bootstrap.min.css (used for responsive portal website), banner image, home page logo etc. These web files are used to build the default Portals.
To store the actual content of file, portal uses attachment feature of notes associated with a web file record. When files are attached, it has limitation of size it supports to upload based on type of files are being attached.
In this post will see in details about how to use JavaScript as Web File in Power App portal?
I will show you steps how to use JavaScript or jQuery code written in .js Web File can be use in Web Page through Web Template.
Let's see step by step.
Scenario: I have one Web Page (Partial URL as create-application) which contains a Submit button with id InsertButton. On click of this button, I want to show confirm dialog. The code of logic will be written in .js Web File.
Step1: create your .js file which contains your code of logic.
Yea, you are right !. Code is pretty simple. When DOM module becomes ready my code loads and register on click event function which shows confirm dialog when Submit (i.e. InsertButton) is clicked.
Save the file of code with extension (.js) in your local system. This file we need to upload to the Web File in Portal.
Step2: before you upload any file extension to D365, you need to remove restriction. By default D365 restrict some file type and .js type is one of it.
To remove go to Advance Setting - > Administration - > System Setting.
Remove the js from the list of Set blocked file extension for attachments.
Step3: Now go to the Portal Management App and select Web File. Under the Web File, create new Web File. I have already created a Web File with partial URL dnlb_application.js as below.
Name : Enter the name of the Web File.
Website : Select the web site portal for which you are creating web file.
Parent Page : You can select home if you want web file to accessible from home page. You can create the web files for specific pages then you need to the specific page as parent page.
Partial URL : Partial URL is important. Through Partial URL you can access the Web Files. Enter the partial URL text.
Published State : Select published state as Published.
Title : You can specify the title through which you can see the Web File in XrmToolBox and all.
Step4: Once the Web File record is created then go to Notes tab of Web File. Add .js file as attachment which you created and contain code of your logic.
I have attached my saved file as below.
Now the content of notes which we attached can be access through Partial URL.
Step5: To check if it is correctly uploaded, get the portal URL and append the partial URL in the web site URL.
Example: If my Portal Website URL is https://xyz.powerappsportal.com/ then append the partial URL as https://xyz.powerappsportal.com/partialurl. In below image you can I have append my Web File Partial URL as dnlb_application.js. You can see the code written in the attached file. If content load correctly then you successfully uploaded the file.
Step6: Now to use the code of .js Web File in Web Page, you can include this .js Web File in Web Template or Page Template as below.
When you include your web file to Web Template then it can access variable or function which are present in Web Template also.
I have already created Web Template file to load the Web Page. I have placed code as below to include the my Web File with Partial URL dnlb_application.js.
Step7: Now save the Web Template and go to Web Page and try to Click on Submit button.
Bingo !! I got my confirm alert as coded in .js file.
This is how you can use the Web File to your Portal.
Stay Safe and Good Luck !
List (Entity List) Configuration
MS CRM Portal : List (Entity List) Configuration
Basic Form (Entity Form) Configuration
MS CRM Portal : Basic Form (Entity Form) Configuration
- Insert
- Edit
- ReadOnly
Web Page Configuration
MS CRM Portal : Web Page Configuration
- Information
- Localized Content
Featured Posts
Download CRM 365 V9.X Tools using PowerShell
This configuration explains about how to download D365 utility tools step by steps. Step1 : Create a folder in your particular drive where y...
Popular Posts
-
What is Plugin in Dynamics 365? Plugin is custom business logic (code) which is added to dynamics 365 to extend the standard behavior....
-
What is Assign and Share Privilege in Microsoft Dynamics CRM? Ans: Basically two type of entities are created: a. Organization ...
-
Plugin vs Workflow, which will execute first? Execution of plugin and workflow depend on whether it is registered as Per or Post events. B...
-
MS CRM Portal : List (Entity List) Configuration List or Entity List is use to show the list of records in tabular format which are already...
-
MS CRM Portal : What is Site Marker and How to use Site Marker? If you ask what is Site Marker? Answer would be very simple, it use to avoi...
-
How to use JavaScript Web File in Portal? Web file use to store images, .json type file, .js type file, documents and other file types. The...
-
MS CRM Portal : Web Page Configuration Web Page is use to display the content of website. It represents URL in Portal. It is represented wi...
-
What is Field Level Security in Dynamics 365? As name indicates, it is applicable to the entity fields. However all field are not applicabl...
-
Advance Form There are two types of form available in Power App Portal. Basic Form Advance Form Basic Form : It is used to Edit, Create and...
-
What is Append and Append To Privilege in Dynamics CRM 365? When there is N:1 or 1:N relationship between two entities then one entity wil...