0

I'm trying to edit webresources in model driven power apps (especially javascript) with visual studio. The given text editor is the worst way to code more then a few lines.

It seems there were some projects in the past, but they are either outdated or have no documentation.

Can anybody point me to a documentation or has some hints about how to edit jscript files with visual studio (or any other IDE)?

bob
  • 595
  • 2
  • 18

4 Answers4

1

I have used these community tools in the past. Try yourself in your sandbox environments first.

  1. Webresources Manager in XrmToolBox

enter image description here

  1. Microsoft Dynamics 365 CRM Web Resources Updater

enter image description here

1

I would recommend using Visual Studio Code for editing web resources, as it's a much lighter application than Visual Studio. You don't need all the other Visual Studio bloat if you are only modifying web resources.

To deploy your web resources I use spkl. This is a community tool that allows automated deployment of web resources to one or more environments.

Like you mentioned, the inbuilt Power Platform text editor for web resources is garbage and ideally should never be used.

There is plenty of documentation and community blogs on how to configure and customize Visual Studio Code depending on your preferences. The same is true for spkl.

Corey Sutton
  • 134
  • 3
1

If you are building SPA like web resources, Visual Studio Code would be the way to go.

If you want to hook up publishing to dynamics process into script such as "npm run build, etc", cli is more useful than manually upload. I found the following tool very useful as it supports different parameters which can be added to a simple cmd file. "NPM build" supports "POST" step which can call cmd automatically

Example: "postbuild": "publish.cmd",

https://github.com/Softwire/dynamics-crm-ci-clis

SamJackSon
  • 1,071
  • 14
  • 19
0

Check below github project if you want to edit and publish webresource in the D365 itself with a VS Code like experience.

https://github.com/ginow/WebresourceEditor

Introduction

Modifying webresources in D365 CRM is a cumbersome process. If we directly edit the scripts in CRM then intellisense and formatting options aren't available and syntax errors aren't detected. So normally we download and open these webresources in code editors like VS Code and then upload it back into CRM. The solution for above problem is to have an editor like VS Code in the CRM itself. This is achievable by using the Monaco editor which is what powers VS Code, and is open sourced by Microsoft.

Installation

  • Download and import the managed solution WebresourceEditor_managed.zip from the Releases section of this project.

Usage

  • Navigate to Solutions under settings and click on the Webresource Editor button

  • Enter any webresource name you want to edit.

    For example for below webresource the name will be con_samplewebresource.js. You can even partially enter the name like sample.

  • Press CTRL+S to save, CTRL+P to publish or CTRL+SHIFT+P to save and publish.

  • Press CTRL+O to open the webresource in new tab.

  • Almost all other keyboard shortcuts of VS Code editor will work as well.

References

Gino
  • 1
  • 1