All Articles

Introducing: The Evaluator (for IBM BPM)

The Pitch

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.

I’m listening…

Introducing, ‘The Evaluator’ (pardon the awful name).

Here’s a screenshot:

The Evaluator - the hero shot

What am I looking at?

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:

  • String
  • Integer, Decimal
  • Boolean
  • Map, Record
  • NameValuePair

so you can also test against those.

Other Features

  • 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 SystemOut.log.

Enough already! How do I start using this?

Grab it from my Github here.

At the time of publishing this post, this tool has been exported from BAW 18.0.0.2. 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.

(Closing Words of Warning)

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 tw.system.model.findProcessAppByID and executeServiceByName including the SQL execution scripts.

-

Happy evaluating!