This content has been marked as final. Show 2 replies
if you have a Global Automatic activity listening to a JMS queue, here's how you can create a new work item instance in a process using logic in the Global Automatic activity's method. This uses the "Fuego.Lib.ProcessInstance.create()" method shown below:
ProcessInstance is in the Catalog inside Fuego.Lib.
// "args" is an associative string array (Any[String]) argsIn as Any[String] // this assumes that the Begin activity has two argument variables // named "nameArg" and "amountArg" and you're setting them // to the variables "name" and "amount" respectively argsIn["someArgVarName"] = "Hello" argsIn["someBpmObject"] = myBpmObject // logic here to determine the name of the process to create an instance in idOfProcess as String idOfProcess = <hard coded string that has the id (not the name of the process to instantiate> ProcessInstance.create(processId : "/" + idOfProcess, arguments : argsIn, argumentsSetName : "BeginIn")
The processId parameter (the "idOfProcess" variable in the above logic) is the thing I most commonly screw up with this. It is the text you see when you right mouse click the process in the Project Navigator tab -> "Properties". Look at the value in the "Id" field and not the "Name" field here (the name without any space characters). Prefix it with a "/" as is shown here and if you've deployed this using an organization unit (OU) then prefix this to the string also.
The third parameter is almost always "BeginIn". Begin activities in a process can have many incoming argument mappings, the default is "BeginIn". To see yours, double click the process's Begin activity and look at the mapping's name in the upper left corner of the dialog.
"argsIn" is the set of incoming argument variables you want passed into the process. A common mistake is to type in the names of the incoming argument variables without the double quotes like this:
Here is the correct syntax:
. . . // this will *NOT* work argsIn[someArgVarName] = "Hello" argsIn[someBpmObject] = myBpmObject . . .
In this example, the process has two argument variables. It does not matter if the incoming argument variables are primitive type arguments (e.g. String, Integer, Decimal...) or BPM Objects, it is always done the same way. In this example, there is a String incoming argument called "someArgVarName" and a BPM Object incoming argument called "someBpmObject".
. . . // this *WILL* work argsIn["someArgVarName"] = "Hello" argsIn["someBpmObject"] = myBpmObject . . .