3 Replies Latest reply: Feb 27, 2014 4:03 PM by Daniel Atwood RSS

    Create new instance in a diferent project

    Kash

      Im trying to create a new instance in one project, I'm using a global interactive activity for this, when tried to create the instance receipt this message in the BPM log  "JavaLangNullPointerException", the global  global interactive activity is in a different project to i want to create the instance.

       

      This is the code i used in BPM

       

           args["argPrueba"] = 1234

           result2 = ProcessInstance.create(processId : "/Test",arguments : args, argumentsSetName : "BeginIn")

       

      in the other project i configure the beginIn activity  this way:

       

           idPrueba = argPrueba

       

      I used BPM 10g

        • 1. Re: Create new instance in a diferent project
          Daniel Atwood

          Your logic looks good but if I recall correctly, you can't use this logic to create an instance in a process outside of your project.

           

          Might want to consider invoking it as a web service.

           

          Dan

          • 2. Re: Create new instance in a diferent project
            Kash

            thanks for your answer Daniel. i tell you the other process are in the same project , i have many process in the same project, but with that logic doesn't work

            • 3. Re: Create new instance in a diferent project
              Daniel Atwood

              If you cannot create instances in processes in the same project, then you'll need to double check your logic.

               

              1. Verify that "args" is an associative string array (Any[String]).  Believe this defaults to a variable called "argsIn" (you have "args" in your logic).

               

              // 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

              2. Double check your other parameters in the logic. 

              Instance.create(processId : "/" + idOfProcess, arguments : argsIn, argumentsSetName : "BeginIn")

               

              The processId parameter is the thing I most commonly used to 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".

               

              Dan