1
0
-1

How to work with textarea & workflow variable? In text area used multilines(enter was pressed while filling textarea). Then i try to use it in beanshell:

....

WorkflowManager wm = (WorkflowManager) pluginManager.getBean("workflowManager");

n = "#variable.vComments#"
wm.activityVariable(workflowAssignment.getActivityId(), "vComments2", n);

...

where vComments is workflow variable placed at form in textarea property

i get error

ERROR 18 Sep 2015 09:50:17 org.joget.apps.app.lib.BeanShellTool - Error executing script
Sourced file: inline evaluation of: ``import org.joget.workflow.model.service.*; import java.util.ArrayList; import j . . . '' Token Parsing Error: Lexical error at line 7, column 10. Encountered: "\r" (13), after : "\"\u0420\u0430\u0437": <at unknown location>

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      solution:

      import org.joget.workflow.model.service.*; 
      import java.util.ArrayList;
      import java.lang.*;
      WorkflowManager wm = (WorkflowManager) pluginManager.getBean("workflowManager");
      String n = wm.getProcessVariable(workflowAssignment.getProcessId(), "vComments");
      String vResult = n.replace("\r","<BR/>");
      wm.activityVariable(workflowAssignment.getActivityId(), "vComments2", vResult);

      or

      String vResult = n.replace("\r"," ");

      for noneHTML content.

      No errors with multiple lines variable vComments

        CommentAdd your comment...
      1.  
        1
        0
        -1

        When the hash variable parsed, you end up with coding with multiple lines. Example:-

        From

        n = "#variable.vComments#"

        To

        n = "hello
        world";

        causing syntax error.

        Workflow variable should be used for routing, not keeping values imho.

          CommentAdd your comment...