code Issue - getDocument not performing as expected...

Hi there,

Bonita Studio 6.3.7, Java 1.7.0.67, Windows 8.1

I’m trying to pass documents from one process to another (without using a Document Management System) and have based my code on the following post: how-get-document-pool-subprocess

The rational being that a sub-process is by definition just a called process.

HT=Human Task

In my pool I have a start->HT-Get Files->HT-Display IDs->end

In the pool I have 5 documents (1-5) which I populate in HT-Get Files. On exit of this task I have a script connector (code shortened but repeated for 2-5):

Long TdocId_1 = 0; //set the Long

try{
//get the id
TdocId_1 = apiAccessor.getProcessAPI().getLastDocument(processInstanceId, “document1”).getId();
}
catch(Exception DocumentNotFoundException){}
catch(Exception e0){
TdocId_1 = -99
}
//put the TdocId into my pool variable
apiAccessor.getProcessAPI().updateProcessDataInstance(“docId_1”, processInstanceId, TdocId_1);

On execution:

HT-Get Files - I add 2 files leaving the other three blank. HT-Display Files - This shows ID values for All files, and not 0 or -99 for the last 3 unfilled files which is wrong.

getLastDocument seems to be returning values for non-existent documents.

  1. How do I get getLastDocument to work correctly?
  2. is a blank URL being seen as beening a valid value when it shouldn’t?

Thanks and regards
Seán