George_V
(Hurricane Bride)
November 13, 2019, 1:31pm
#1
Hello,
I am trying out the new BProc addon. In a process modeler I set form type to Input dialog and added a process variable, I decided to create a simple script in order to change the value of the variable.
There is no information about scripts in BProc official documentation, though in the previous BPM documentation I could find a few words about it.
Could you provide some information and examples of creating scripts with BProc. In my case the script is to change the value of process varriable (string type)
I am looking forward to fast reply.
gorbunkov
(Maxim Gorbunkov)
November 13, 2019, 2:49pm
#2
Hi,
BProc doesn’t add anything to ScriptTask functionality provided by the Flowable engine. The Flowable documentation says:
All process variables that are accessible through the execution that arrives in the script task can be used within the script
It’s also possible to set process variables in a script, simply by calling execution.setVariable(“variableName”, variableValue)
So just type
execution.setVariable(“variableName”, variableValue)
in the Script field of the ScriptTask.
It will be useful to have this information also in the BProc documenation, we’ll add it. Thank you for the hint.
1 Like
George_V
(Hurricane Bride)
November 13, 2019, 3:29pm
#3
Max, thanks for your reply, I have tried to set the script in the same way and typed:
execution.setVariable(“state”, rejected)
where “state” is the variable name and rejected is it’s supposed value (state is a string type)
So here is a error during the process execution:
MissingPropertyException: No such property: rejected for class: Script36
Max, I appreciate your reply and want to find a proper solution for this problem, providing some screenshots.
gorbunkov
(Maxim Gorbunkov)
November 13, 2019, 5:15pm
#4
The script language is Groovy, so if you need regular strings put text literals in single quotes:
execution.setVariable('state', 'rejected')
Groovy documentation for strings: The Apache Groovy programming language - Syntax
George_V
(Hurricane Bride)
November 14, 2019, 8:41am
#5
gorbunkov:
variableValue
Finally the script works as it’s supposed to do, Many thanks, Max!
a05060509
(A05060509)
March 12, 2021, 9:31am
#6
i hava a question ,i cant use this “ @Autowired
private VariableService variableService;”
why?