Home > Enterprise >  how to set service task results into a camunda form
how to set service task results into a camunda form

Time:12-02

Currently I'm trying to implement fetching task results into a camunda form because each result have multiple values and user going to choose which value is best. I'm trying to use camForm.variableManager but it's returing undefined. How can I achive this, any references,examples please suggest.

I tried to use below code:

 <script cam-script type="text/form-script">
        var variableManager = camForm.variableManager;    
        var jobRequestInfo = $scope.jobRequestInfo = {};
        camForm.on('variables-fetched', function() {
            alert(Object.values(variableManager.variables));
            console.log(camForm.variableManager.variable( 'a' ));
          });
    </script>

I was sending result from pool A to pool B, by using expression stament.

${execution.getProcessEngineServices().getRuntimeService().createMessageCorrelation("changerequirement").setVariable("a", 1).correlateWithResult()}

CodePudding user response:

Use fetchVariable() function before using get value function.

<script cam-script type="text/form-script">
    camForm.variableManager.fetchVariable('a');
     camForm.on('variables-fetched', function() {
       console.log(camForm.variableManager.variable('a'));
       console.log(camForm.variableManager.variableValue('a'));
          });
    </script>

Reference link: https://forum.camunda.org/t/get-all-users-from-group-in-cam-script-directive-embedded-form/17592/5

  • Related