Hear from Salesforce leaders on how to create and deploy Agentforce agents.
Contact Us 1-800-596-4880

Use Constant Directives

This DataWeave example builds URLs from constants that are defined as variables (var) in the DataWeave header. It also conditionally outputs fields if they are present in the input. Before you begin, note that DataWeave version 2 (%dw 2.0) is for Mule 4 apps. For a Mule 3 app, refer to DataWeave version 1 (%dw 1.0) examples, within the Mule 3.9 documentation set. For other Mule versions, you can use the Mule Runtime version selector in the table of contents.

The example uses these functions:

  • ++ (concatenate) to build constant directives into URLs.

  • map to go through the fields in the input.

  • if to output summary and brand fields.

DataWeave Script:
Input XML Payload:
Output JSON: