Skip to content

BasicDataWeaveInApexRecipes

pozil edited this page Oct 16, 2023 · 4 revisions

BasicDataWeaveInApexRecipes

Demonstrates various ways of invoking a DataWeave scripts in Apex. Note that this class demonstrates both static and dynamic way of invoking DataWeave scripts.For more DataWeave for Apex example head to https://github.com/developerforce/DataWeaveInApex.

Group DataWeaveInApex Recipes

Methods

public static String staticInvocation()

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

Returns

Type Description
String the result of output from DataWeave script in the string format

public static String dynamicInvocation(String scriptName)

Demonstrates how to invoke a DataWeave script in Apex using dynamic invocation. For dynamic invocation use DataWeave.Script.createScript. The class uses the /dw/helloWorld.dwl script to log a message

Parameters

Param Description
scriptName name of the DataWeave metadata to invoke

Returns

Type Description
String the result of output from DataWeave script in the string format

Clone this wiki locally