You’re writing up some code for your server script, but you’re not sure if it’ll work. It’s an API you’ve never used before, or the documentation is a bit unclear. Or perhaps you’re not sure if the JS is right.
But you don’t want to make a service flow and setup variables just to test out a small bit of code. You just want to run something, and get a result quickly.
Introducing, ‘The Evaluator’ (pardon the awful name).
Here’s a screenshot:
This tool is a (Coach)View running in a client-side human service with a service flow evaluating your script. You type your code into the top half (a browser JS editor) and when you click ‘run script’ that code will be run on your BPM server. All the results of that run will be output into the browser web inspector console.
You are able to assign to various other TW types and their lists, such as:
- Integer, Decimal
- Map, Record
so you can also test against those.
- Autosave - all your code is automatically saved to your browser as you type, no need to copy+paste it out to preserve it
- Control-Enter to run - if you like your keyboard shortcuts, you can also just use the handy shortcut to run without your hand ever leaving your keys
- Logger function - if your code is a little more complex, we have a convenience logger
llog(args)that will be logged out to your browser window with your results in the right order.
- Stopwatch - each time your code runs, you’ll find out how long it took actually took to run (note: the executing engine only has a time granularity of 16ms, so it may say 0ms when it was more, or it may say 16ms when it was much less).
- Locking it down - if you want to limit who can use this tool (separately from the ‘expose to’) settings, you can turn on a ‘secure mode’ where each user must enter in a valid key to use the service. This is off by default.
- Errors are neatly extracted back to you in the console
- Finally, all scripts are logged to
Grab it from my Github here.
At the time of publishing this post, this tool has been exported from BAW 188.8.131.52. If anyone wants to downgrade the system toolkit and submit a pull request, I’ll be happy to include it.
Like any other process application, it’s easy to get started. Just import to your Process Center (or Server), modify the access privileges for the main CSHS, and share the URL to the screen.
Remind yourself and anyone using this tool, that an infinite loop executed from this tool is an infinite loop on the BPM server - you will need to restart the node to end the loop. Refreshing the browser won’t stop it.
And, it’s a console for your BPM server. It has the same access as your developers do. So limit
access where necessary. Any service in any snapshot can be run via
executeServiceByName including the SQL execution