Metastorm BPM : Copy current folder ID to the clipboard

When I’m troubleshooting folder issues by running tests with forms via the Metastorm web client, sometimes I quickly need to know the folderID of the folder I’m currently working on in order to query the database for further information about the folder (such as variable values etc).  Generally, unless you’ve already done what’s being discussed here, you won’t have the folder ID available to you from the web client, only the folder name shows in your folder list and in order to find out the folder ID, you  then use the folder name to query the eFolder table.  I want to go from looking at the folder to querying the database as quick as possible.

There are different ways to program your forms to show you the folderID of the current folder via the web client, one such method could be a calculated field showing the %FolderID value, but let’s face it, you don’t want your users seeing this do you?  One alternative method would be to have a button, visible only to Metastorm Admins for example (query the eAssignment table for the current users roles) which then queries the database for the current folder name.  Again, not bad, but that’s two queries more than we need.

When your Metastorm form loads in the browser, it’s pure HTML and Javascript.  If you take a look at the HTML source of the form, you’ll notice that there are a collection of hidden input fields loaded and one of those holds the value of the current folders ID.  This being the case, we can just grab the value of this hidden field. My solution is to use the form onLoad event for each of my forms to run a simple javascript function which copies the current folder ID to the clipboard for me.  This way, whenever I’m trouble shooting any folder issues, I instantly have the applicable folder ID copied in memory and ready for me use in my SQL queries.  I just wish SQL Server Management Studio would render the SQL query I am currently thinking about to save me even more time.

Here’s the code:

I should mention that this works with IE only and so if you are using the later SR releases of Metastorm 7.6 and support firefox in your setup, this won’t work.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s