In Power Apps or CRM Development, we have to update the code by navigating to the web resource every time and publish it. But, here is a great solution which is Dataverse DevTools. This simplifies the task by publishing of web resource within VS Code itself.
Install Dataverse DevTools from the extensions in Visual Studio Code.
In VS Code, create a JavaScript file.(I have created a file named alert.js)
In VS Code click on the Dataverse icon on the vertical bar on the left.
Click on Create New Connection button to create a connection between your VS Code and Dataverse
Enter your environment URL in the prompt and then press Enter
In the next prompt select Microsoft Login Prompt and press Enter
Select any one option in the list
If this page appears on the browser, the authentication is successful. Then move to VS Code.
The connection section shows that the connection is established between Dataverse and VS Code.
Expand the web resources and you will see all the web resources in your environment.
Click on the bulb icon adjacent near to the web resources.
A page appears with all the files in your folder.(In my case I have only one js file).
Click on the link button, a prompt pops out and asks to link the existing web resource or upload as new web resource. (I want to create a new web resource),
- For linking existing web resource select the web resource to link with the local file.
- Select a solution where you want to create that web resource.
- In the next prompt add a display name and press Enter.
- In the next prompt enter the logical name without prefix and press Enter.
The local file is connected with the dataverse web resource.
Update the file with some code and save.(I have used the above code to show an alert).
In the smart match page click on the upload, then the status of the file gets up-to date.
Use the function in any of the triggering event then save and publish the form.(I have used it in account form - download).
Go to the form and check if it works,
That’s Great Right... By this you can push your code to Dataverse without publishing.
Thanks.