Getting started with Flow.apex
13 min 30 sec
Function Invocation
We can invoke functions in Flows.
Flow f = new Flow()
.inputAs('a', 'b').returnInteger()
.var('num = add(a, b)');
1
Flow f = new Flow()
2
.inputAs('a', 'b').returnInteger()
3
.var('num = add(a, b)');
Here we assign the value of num
to be the result of calling add(a, b)
.
Funcs from R.apex are imported in Flow.apex. If you want to import custom Funcs, see below.
Flow.addFunc('plus', R.add);
1
1
Flow.addFunc('plus', R.add);
This will register the Func R.add
in the name of plus
. So you can refer it now in FlowScript.
Flow f = new Flow()
.inputAs('a', 'b').returnInteger()
.var('num = plus(a, b)');
3
1
Flow f = new Flow()
2
.inputAs('a', 'b').returnInteger()
3
.var('num = plus(a, b)');