Web resources are virtual files that are stored in the Microsoft Dynamics 365 database and that you can retrieve by using a unique URL address. They can be referenced in multiple places such as in sitemaps, in entity forms, in dashboards, and command buttons. We can create the following different types of web resources like Webpage(HTML), Script(JScript), etc.
Limitations of Web resources
• There is no supported way of using the server-side code in HTML Web Resources.
• A web resource can contain code that is processed in the browser to execute web service calls to interact with Dynamics 365 data.
• Web resources are only available by using the Dynamics 365 web application security context. Only licensed Dynamics 365 users who have the necessary privileges can access them.
We can upload the maximum size of files by Organization.MaxUploadFileSize property. Go to the System Settings in the Dynamics 365 application you can set this property in the Email tab and Set Maximum file size (in kilobytes). This setting limits the size of files that can be attached to email messages, notes, and web resources. The maximum default of the file that can be uploaded as a Web resource is 5 MB.
Creating Web Resources
Before creating your Web resource which is need to be important. It is always recommended to create you web resource in a custom solution so that it can be easily exported and deployed to other environments.
Create and Edit Web Resources
• Go to you demo solution- Setting/Solution.
• Under Components, choose Web Resources.
• To create a web resource- Choose New.
To edit a web resource- Double click the web resource you want to edit.
• The web resource form has the following fields and capabilities.
Display Name: Demo.js
Type: Web Page (HTML)
Note: Prefix will be added to Name automatically based on the publisher being selected while creating the solution.
• Click on the Text Editor button to open the editor.
• Design your first HTML web page contents in the Rich Text editor.
• Use the Rich Text editor toolbar to modify the content style.
• Click on OK to close the Text Editor.
• Click on the Save and Publish buttons.
• Click on the PREVIEW button on the top to preview our HTML web resource.
Accessing forms and controls using client-side code
Use the data and ui objects under the formContext object to programmatically manipulate data and user interface elements in Customer Engagement.
Understanding client-side events
We have two events where we can write our client-side code: