• 1Installation
  • 2Preliminary Knowledge
  • 3FlowScript
  • 4Flow Func Signature
  • 5Variable Assignment
  • 6Function Invocation
  • 7Return Statement
  • 8If Block
  • 9For Block
  • 10While Block
  • 11Break and Continue
  • 12Switch Block
  • 13Recursion
  • 14Flow Debug

Flow.apex

  • Docs
  • Tutorials
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)');
Done
Copy