Skip to content

BasicDataWeaveInApexRecipes

pozil edited this page Nov 14, 2024 · 4 revisions

BasicDataWeaveInApexRecipes Class

Demonstrates various ways of invoking a DataWeave scripts in Apex. Note that this class demonstrates both static and dynamic way of invoking DataWeave scripts.

Group DataWeaveInApex Recipes

Methods

staticInvocation()

Invokes a DataWeave script in Apex using static invocation. Uses the /dw/helloWorld.dwl DataWeave script to log a message. This shows how to invoke the script using the Apex class that is automatically generated by the platform from the DataWeave script. The DataWeave script is deployed as metadata.

Signature

public static String staticInvocation()

Return Type

String

output of the DataWeave script as a string (hard coded to "Hello World")


dynamicInvocation(scriptName)

Invokes a DataWeave script in Apex using dynamic invocation thanks to DataWeave.Script.createScript() .

Signature

public static String dynamicInvocation(String scriptName)

Parameters

Name Type Description
scriptName String name of the DataWeave metadata to invoke

Return Type

String

output of the DataWeave script as a string

Clone this wiki locally