/ d365

[D365] SysClassRunner as JavaScript bookmark with parameters

With D365fO we have couple of ways to run classes in our environments.

The first one is to make a menu item, attach the class to it and put that on a form to call it then.
Another one is to set the class as startup object for a project in Visual Studio and run this project.

The third is using SysClassRunner query parameter in the URL of the environment.
The syntax is: BaseURL?mi=SysClassRunner&cls=CLASSNAME.
For example: https://usnconeboxax1aos.cloud.onebox.dynamics.com/?cmp=usmf&mi=SysClassRunner&cls=SysFlushAOD

For sure this URL could be saved as a bookmark but then every time we need to wait until the class of the bookmarked URL is run, change the query parameter to the new class we'd like to run and wait again.

Since JavaScript can be used in bookmarks, why not create an interactive bookmark that asks you for the company and the class you'd like to run upfront?

javascript:(function() {var clsname = prompt("Please enter the name of the class", "SysFlushAOD"); var company = prompt("Please enter the company", "104"); if (!company) {company =  "usmf";} if (clsname && company) {window.location="https://usnconeboxax1aos.cloud.onebox.dynamics.com/?cmp="+company+"&mi=SysClassRunner&cls="+clsname;}})();

This will prompt you for the name of the class and the company. You can set the defaults in the second parameter of the prompt() function. For example if you test in a specific company most of the time, you'll likely set it as default.

Important note: you need to be on a loaded site with Chrome to be able to execute a JavaScript bookmark. The empty new tab page won't work!

[D365] SysClassRunner as JavaScript bookmark with parameters
Share this

Subscribe to robsCode