2 Replies Latest reply on Jan 31, 2013 3:23 PM by user12051690

    Start a new process from a running process BPM 10.3 STUDIO!

      Is it possible to create a process in BPM Studio 10.3 from a running process.
      The scenario is that we have a process running listening to a jms queue an when a message
      arrives it's starts the process that was requested in the in message.

        • 1. Re: Start a new process from a running process BPM 10.3 STUDIO!
          Dan Atwood
          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:
          // "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") 
          ProcessInstance is in the Catalog inside Fuego.Lib.

          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:
          . . . 
          // this will *NOT* work
          argsIn[someArgVarName] = "Hello"
          argsIn[someBpmObject] = myBpmObject
          . . .
          Here is the correct syntax:
          . . . 
          // this *WILL* 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".

          • 2. Re: Start a new process from a running process BPM 10.3 STUDIO!
            Well now i tried this and with the same result i think.
            I get the error Listener
            Error during JMS request processing. Java Error:Different engine instance creation not supported.
            So I believe the question is, could i start an process in another project in Studio ( workshop workspace)?