Creating a macro

You can execute JavaScript code from within your flow, by using the Macro element in Boomi Flow.

Some of the things macros can be used for:

  • Calculations: X times Y
  • Logic: If X is greater than Y, Then…
  • Data validation: If X == “”, Then generate an alert that X can not be empty

The macro element has its own editor in the Drawing Tool. You can access it by selecting Macros from the sidebar.

Here is how you can create a macro:

  1. Click Macros.
  2. Click New.
  3. Enter a name for the macro, and click Save.

    This saves the macro. You will see an alert message if you have unsaved changes.

Boomi Flow macros are shared elements – once created, a macro can be used by any flow in the tenant.

The macro needs to be imported in the flow, and added using the Operator element before it can be used.

—We recommend using JavaScript for logic, and not  asynchronous code.
—Macros should also not be used for generating an UI directly (use Players for that).
—Boomi Flow does not allow external API calls as part of the macro.

You may also want to see: