Search My Ramblings

Monday, August 24, 2009

Using BPEL's Custom Indexes for BPEL Console Searching

Recently I had a request to store unique identifiers (nothing in violation of SOX requirements, a custom number only recognized at this client) as one of the custom indices in BPEL so associated instances could be searched using the BPEL Console.

While this isn't a difficult thing, as the API is well-defined and easy to use within an embedded Java activity, I ran into some things that may save you some debugging time in the future, or myself when I search my own blog later to "remember" how I got it working as expected.

This blog posting will be short and sweet. The one caveat that I found was if you have either an XML-based or Message-based variable, be careful with the getVariableData function, as it will generally return an Oracle XMLElement object, so you'll need to get the text from it and not call the toString() function of it when setting the custom index. I've generally found it much easier to create a Simple-type variable of type String, then use a Copy operation with an Assign activity to get the value from within either an XML-based or Message-based variable into the simple String variable, then in the embedded Java it's easy to use getVariableData(variableName).toString() to set the custom index.