-
Notifications
You must be signed in to change notification settings - Fork 464
BasicDataWeaveInApexRecipes
pozil edited this page Nov 14, 2024
·
4 revisions
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
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.
public static String staticInvocation()
String
output of the DataWeave script as a string (hard coded to "Hello World")
Invokes a DataWeave script in Apex using dynamic invocation thanks to DataWeave.Script.createScript()
.
public static String dynamicInvocation(String scriptName)
Name | Type | Description |
---|---|---|
scriptName | String | name of the DataWeave metadata to invoke |
String
output of the DataWeave script as a string