Newer Version Available
Examples of DataWeave in Apex (Developer Preview)
Here are code samples that demonstrate DataWeave in Apex.
These are instructions to use DataWeave in Apex, with an associated example.
- Create a scratch org that has the DataWeaveInApex feature included in its definition file. See Build Your Own Scratch Org Definition File.
- Create a DataWeave script source file. For example: csvToContacts.dwl.
- Create the associated metadata file.
For example: csvToContacts.dwl-meta.xml.
- Push the source to the scratch org using Salesforce CLI version v7.151.9 or higher. See Salesforce CLI Release Notes.
- Invoke the DataWeave script from Apex and check the results from anonymous
Apex.This example invokes the csvToContacts.dwl script.