Topic
6 replies Latest Post - ‏2013-11-05T15:53:11Z by kolban
SystemAdmin
SystemAdmin
7615 Posts
ACCEPTED ANSWER

Pinned topic Changing variable value in a BPD

‏2012-04-12T19:48:16Z |
Is there a way to change the value of a complex variable in a BPD from another BPD?

I found a way to read the values, but I can't save them.

Here is how I am trying it:
var instance = com.lombardisoftware.client.persistence.BPDInstanceFactory.getInstance().findByPrimaryKey(com.lombardisoftware.client.persistence.common.ID.get(com.lombardisoftware.client.persistence.common.POType.BPDInstance,
java.math.BigDecimal('66')));

var execContext = com.lombardisoftware.bpd.runtime.engine.BPDInstanceDAO.getBPDExecutionContext(instance);
var lst = execContext.getExecutionTree().getRoot().getLocalSymbolTable();

tw.local.input = lst.get('VariableValue'); // THIS WORKS!

lst.set('VariableValue', tw.local.output); // THIS DOES NOT WORK!, error message below.

com.lombardisoftware.bpd.runtime.engine.BPDInstanceDAO.save(execContext);
Here is the error message:

Runtime error in script ("Process: 'teste' ProcessItem: 'Sem Título1' Type: 'ITEM'" 9:0).Internal Script error: com.lombardisoftware.core.TeamWorksRuntimeException: com.lombardisoftware.core.TeamWorksException: Type mismatch. Value "XXXXXX" must be instance of structured IBM BPM type. Java class found: com.lombardisoftware.core.script.js.TWObjectScriptable
CAn someone help me?
Updated on 2013-01-22T17:19:32Z at 2013-01-22T17:19:32Z by RhettWhaley
  • SystemAdmin
    SystemAdmin
    7615 Posts
    ACCEPTED ANSWER

    Re: Changing variable value in a BPD

    ‏2012-04-14T01:48:21Z  in response to SystemAdmin
    What you are calling is not a supported API and therefore could be broken by any update of the code. the only supported way to do this today would be via an IME.

    Andrew Paier | Director of Special Operations | BP3 Global, Inc. www.bp-3.com
    • SystemAdmin
      SystemAdmin
      7615 Posts
      ACCEPTED ANSWER

      Re: Changing variable value in a BPD

      ‏2013-01-22T12:03:36Z  in response to SystemAdmin
      But by using IME it is not possible to retrieve the variable from an inflight instance.
      Is there any other way using which we can retrieve the a variable from an inflight instance.

      Thanks,
      Pradeep
    • SystemAdmin
      SystemAdmin
      7615 Posts
      ACCEPTED ANSWER

      Re: Changing variable value in a BPD

      ‏2013-01-22T12:03:59Z  in response to SystemAdmin
      But by using IME it is not possible to retrieve teh variable from an inflight instance.
      Is there any other way using which we can retrieve the a variable from an inflight instance.

      Thanks,
      Pradeep
      • RhettWhaley
        RhettWhaley
        40 Posts
        ACCEPTED ANSWER

        Re: Changing variable value in a BPD

        ‏2013-01-22T17:19:32Z  in response to SystemAdmin
        We have achieved similar functionality of updating task data by using the REST API and Java/Groovy. For example calling the /rest/bpm/wle/v1/service/taskID with the setData action. This seems to work, however updating complex variables is not trivial.
        Rhett
        • SG_BPM
          SG_BPM
          187 Posts
          ACCEPTED ANSWER

          Re: Changing variable value in a BPD

          ‏2013-11-05T15:04:11Z  in response to RhettWhaley

          Hi Rhett,

          We can fetch the vaules of a inflight instance using REST API....how can we change a value in an inflight instance and run the same ?

          Did you find anything on this.please share if yes.

          Thanks !

          SG

           

           

          • kolban
            kolban
            3314 Posts
            ACCEPTED ANSWER

            Re: Changing variable value in a BPD

            ‏2013-11-05T15:53:11Z  in response to SG_BPM

            I have looked but I haven't found any ways to change the values of variables in a BPD process using APIs.  Best I have found is the ability to augment a process with event listeners which will perform the work on behalf of a call when the call is made ... but this means cooperation between the process implementation and calls to change the variables.

            Neil