-
Notifications
You must be signed in to change notification settings - Fork 519
FormattingRecipes
pozil edited this page Feb 13, 2024
·
3 revisions
Demonstrates various ways to apply formatting using DataWeave scripts in Apex.
Group DataWeaveInApex Recipes
Outputs a list of contacts in JSON with properly formatted dates. Uses the dw/jsonDateFormat.dwl DataWeave script.
| Param | Description |
|---|---|
contacts |
list of contacts to convert into JSON |
| Type | Description |
|---|---|
String |
JSON string |
Uses the DataWeave pluralize function in a script (https://docs.mulesoft.com/dataweave/2.4/dw-strings-functions-pluralize). Uses the dw/pluralizeFunction.dwl DataWeave script.
| Param | Description |
|---|---|
singularWords |
list of singular words as a JSON string |
| Type | Description |
|---|---|
String |
list of plural words as a JSON string |
Parses a JSON input and escape properties named after Apex reserved keywords (private, object, currency...). Full list of reserved keywords: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_reserved_words.htm Uses the dw/reservedApexKeywords.dwl DataWeave script.
| Param | Description |
|---|---|
jsonInput |
JSON string with Apex reserved keywords used as properties |
| Type | Description |
|---|---|
String |
JSON string without the Apex reserved keywords |