A web resource is any static file — JavaScript, HTML, CSS, an image, an icon, or a silverlight/XAP file (legacy) — uploaded into Dataverse and made available for use inside forms, the sitemap, or ribbon commands.

Creating and naming web resources

Web resources use a prefix-based naming convention tied to your solution’s publisher (e.g. new_/account_form_script.js), and are created and uploaded from inside a solution in the maker portal. Keeping scripts organized under a consistent naming pattern (by table, by purpose) pays off quickly once a project accumulates dozens of them.

Registering a script on a form

  1. Upload the JavaScript file as a new web resource and publish it.
  2. Open the form in the form editor, go to Form Properties (or the modern event panel), and add the web resource as a form library.
  3. Add a new event handler, select the event (e.g. OnLoad), and specify the function name exactly as written in the script.
  4. Check “Pass execution context as first parameter.”
  5. Save and publish the form.
The most common deployment mistake. Editing a JavaScript web resource’s content and saving it is not enough — it must also be published before the new version is actually served to users. Updating the file but forgetting to publish is probably the single most common “why isn’t my change showing up” support question for new D365 CE developers.

Versioning and caching

Browsers aggressively cache web resources. After publishing an update, users sometimes still see stale behavior until their browser cache clears — worth knowing when a change “didn’t work” immediately after publishing but resolves itself (or resolves with a hard refresh) shortly after.