Last week I stumbled across an interesting question in BPM. As it took me some time to figure out why BPM was behaving the way it did, I thouhgt I'd share my findings with you, as it may help you some day as well.
The scenario was the following:
I was using a Human Service (HS) with a Coach that consisted of a Document List and a Document Viewer. My BPM version was 8.5.5 but the exposed behavior is the same in 126.96.36.199 and 8.5.6 as well.
Here is my HS and the Document List Configuration:
As you can see, I used a custom Search Service. My goal was to filter the document list based on the Content Type of the documents stored. I wanted to accomplish that my filter looked up the ContentType in a local variable, so I could simply change the value of the variable without touching my search criteria to adapt my searches.
To do so, I added a search criterion in the Search Service by browsing the Content Filters tab and clicking the "Add Search Criterion..." button:
This will add a new criteria. As I wanted to check for the Mime Type, I selected Mime Type in the first field, and selected "is equal to" in the second field:
In the third field as a first test I wrote "application/pdf" (without the quotes) to see, if it would work:
I ran the HS and it did work:
Now I wanted to use a variable instead of hardcoding the MimeType in my Search Criteria. So I created a new Local Input variable named "ContentType" and set it's default value to "application/pdf":
And I adapted my Search Criteria by entering the name of my variable (tw.local.ContentType) into the third field:
I ran the HS and was surprised to see the following results:
Why was that?
Looking at the DataMapping, I found the following CMIS query:
"SELECT cmis:name, cmis:contentStreamMimeType, cmis:objectId, cmis:versionSeriesId, IBM_BPM_Document_FileNameURL, IBM_BPM_Document_FileType FROM IBM_BPM_Document WHERE (cmis:contentStreamMimeType = 'tw.local.ContentType') ORDER BY cmis:name ASC"
As you may note, the variable name I entered in the search criteria was interpreted as a string. No surprise this was not working. There was no document with a Mime Type of "tw.local.ContentType".
So, how was I able to solve it?
It is fairly simple, just follow these three steps:
The result will look like this:
Note the different font, compared to when I wrote the variable name in the field manually:
Looking at the Data Mapping now, I saw the following CMIS query:
"SELECT cmis:name, cmis:contentStreamMimeType, cmis:objectId, cmis:versionSeriesId, IBM_BPM_Document_FileNameURL, IBM_BPM_Document_FileType FROM IBM_BPM_Document WHERE (cmis:contentStreamMimeType = '" + tw.local.ContentType + "') ORDER BY cmis:name ASC"
Now that looked way better. to confirm it was working, I simply re-ran the HS:
And it worked like a charm.
I hope this will help you some day. And if it does not help, take two of these and call me in the morning.