Skip to content

Commit e619502

Browse files
Merge branch 'MS2026-02-17-ACB' into W-21199055-Create-MinMuleRuntimeVersion-note-CP
2 parents 8d9e4a1 + 3711d4d commit e619502

1 file changed

Lines changed: 99 additions & 12 deletions

File tree

modules/ROOT/pages/int-configure-dw-expressions.adoc

Lines changed: 99 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
= Using DataWeave Expressions and Transformations in Anypoint Code Builder
22
:page-aliases: int-use-dw-to-transform-data.adoc, int-address-dw-errors.adoc, int-import-dw-libraries.adoc
33

4-
DataWeave is the MuleSoft programming language for data transformation and for defining expressions. Use DataWeave to process Mule event data, such as `payload`, `attributes`, and `vars`, in connector operations and other components. Develop DataWeave expressions and transformations in your Mule applications using the *Expression Field*, *Expression Builder*, or *Transformation Builder*, or by editing the configuration XML. Generate DataWeave transformations with AI help by providing input and output sample data, metadata, or both.
4+
DataWeave is the MuleSoft programming language for data transformation and for defining expressions. Use DataWeave to process Mule event data, such as `payload`, `attributes`, and `vars`, in connector operations and other components. Develop DataWeave expressions and transformations in your Mule applications using the *Expression Field*, *Expression Builder*, or *Transformation Builder*, or by editing the configuration XML. Generate DataWeave transformations with AI help by providing input and output sample data, metadata, or both. AI-powered auto mapping provides comprehensive error feedback for GenAI actions, including authorization, metadata, and request limits, ensuring a more reliable and guided mapping experience.
55

66
image::int-dw-transform-ui.png["A configuration panel showing three numbered callouts: 1) fx button for Expression Field, 2) Expression Builder button, and 3) Transformation Builder button"]
77

@@ -105,7 +105,7 @@ image:int-dw-fx-data-tab.png["Data tab for expression field"]
105105
image:int-dw-fx-data-tab-attributes.png["Data tab for expression field with mock attributes"]
106106
|===
107107

108-
Automatically generated strings are displayed as mock values and are used to generate output for previews, such as in the <<tab-preview, Preview>> tab. The attribute metadata keys in the example come from the configuration of an `HTTP Listener` component in the flow.
108+
The IDE shows the automatically generated strings as mock values and uses them to generate output for previews, such as in the <<tab-preview, Preview>> tab. The attribute metadata keys in the example come from the configuration of an `HTTP Listener` component in the flow.
109109

110110
The *Input/Output* tab shows the structure of data entering (*Input*) and exiting (*Output*) components. For example:
111111

@@ -121,7 +121,7 @@ To get a list of available functions from a component *Functions* tab, the *fx*
121121
For guidance, see <<open-fx-field>>.
122122
. List available functions:
123123

124-
* To show a list of DataWeave functions from the Core module from an empty *fx* field, press Ctrl+Space in an _empty_ *fx* field. For example:
124+
* To show a list of DataWeave functions from the `Core` module from an empty *fx* field, press Ctrl+Space in an _empty_ *fx* field. For example:
125125
+
126126
image::int-dw-fx-field-autocomplete.png["DataWeave autocomplete dropdown menu showing available Core module functions like abs, avg, ceil, and floor with their descriptions"]
127127
* To show functions from all xref:dataweave::dw-functions.adoc#dw_modules[DataWeave modules], such as `String`, `Array`, and `Core` modules:
@@ -206,15 +206,18 @@ If using AI-assisted transformations, evaluate these considerations:
206206

207207
* To generate a DataWeave script using *Map and Transform with AI*, provide input and output samples. While optional, providing metadata helps AI understand the data structure and improves the accuracy of the transformation.
208208
* Sample data provides the context to generate functions or expressions for calculations, conditions, and other operations. You can provide Web Services Description Language (WSDL) files with sample data. See <<sample-data>> for supported data formats (MIME types) for sample data.
209-
* For automatic field-to-field mapping using *Map with AI*, provide both input and output metadata. *Map with AI* works only if no DataWeave script exists in the component.
209+
* For field-to-field mapping using *Map with AI*, provide both input and output metadata. Use *Map with AI* even when a DataWeave script is already present in the component. Click *Map with AI* to trigger it.
210210
* AI requires valid data to create the transformation script. Write it manually if needed.
211211
* AI chat history isn't available in *Transformation Builder*.
212212
* Avoid using real personally identifiable information (PII) in sample data or AI inputs. Provide input and output sample data that contains only fictional or masked data.
213+
* AI-assisted transformations provide comprehensive error feedback for GenAI actions. If you encounter errors related to authorization, metadata, or request limits, the error messages guide you to resolve the issue. See <<troubleshoot-ai-assisted-transformations>> for detailed troubleshooting steps.
213214

214215
[[map-with-ai]]
215216
=== Map with AI
216217

217-
The *Map with AI* feature automatically suggests a field-to-field mapping. This feature requires you to provide both input and output metadata for the component and triggers only when no DataWeave script is present. It performs auto-mapping based on the provided metadata.
218+
The *Map with AI* feature suggests a field-to-field mapping using AI-powered auto mapping. Click *Map with AI* to trigger it. Use it even when a DataWeave script is already present in the component. Provide both input and output metadata for the component. Mapping is performed based on the metadata you provide.
219+
220+
*Map with AI* provides comprehensive error feedback for GenAI actions, including authorization errors, metadata issues, and request limits. If you encounter errors during the mapping process, see <<troubleshoot-ai-assisted-transformations>> for detailed guidance on resolving specific error types.
218221

219222
If you don't have access to *Map with AI*, you must:
220223

@@ -227,11 +230,9 @@ If you don't have access to *Map with AI*, you must:
227230
+
228231
image::int-map-with-ai.png["Transformation Builder showing 'Fetching metadata' status message with loading indicator for AI-assisted mapping functionality"]
229232
+
230-
The mapping starts automatically considering the sample data provided.
231-
+
232-
The mapping is applied to the XML file.
233+
. Click *Map with AI* to start the mapping. Provide both input and output metadata if not already provided.
233234
+
234-
The *Preview* tab shows the output of the transformation.
235+
The mapping is applied to the XML file, and the *Preview* tab shows the output of the transformation.
235236
. After the mapping is complete, you must:
236237
.. Click *Apply Mapping* to apply suggested mapping to your project.
237238
.. Click *Revise Mapping* to get new suggestions from the AI.
@@ -265,11 +266,97 @@ After inserting a script, the XML file is updated, and you can regenerate the sc
265266
[[troubleshoot-ai-assisted-transformations]]
266267
=== Troubleshoot AI-Assisted Transformations
267268

268-
If you have issues with the AI-assisted transformations, follow these steps:
269+
AI-assisted transformations in *Transformation Builder* provide comprehensive error feedback to help you resolve issues. Error messages indicate the type of error and provide guidance to resolve it.
270+
271+
If you encounter errors when using AI-assisted transformations, identify the error type and follow the corresponding resolution steps:
272+
273+
* <<troubleshoot-authorization-errors, Authorization Errors>>
274+
* <<troubleshoot-metadata-errors, Metadata Errors>>
275+
* <<troubleshoot-request-limit-errors, Request Limit Errors>>
276+
* <<troubleshoot-general-ai-errors, General AI Errors>>
277+
278+
[[troubleshoot-authorization-errors]]
279+
==== Authorization Errors
280+
281+
Authorization errors occur when your Anypoint Platform account lacks the required permissions or when Einstein generative AI isn't properly configured for your organization.
282+
283+
If you receive an authorization error:
284+
285+
. Verify that you are logged in to Anypoint Platform from Anypoint Code Builder.
286+
+
287+
For more information, see xref:start-acb.adoc#log-in-to-anypoint-platform-from-the-ide[Log in to Anypoint Platform from the IDE].
288+
. Contact your Anypoint Platform organization administrator to verify:
289+
+
290+
* You have the *Mule Developer Generative AI User* permission assigned in Anypoint Platform access management.
291+
* Einstein generative AI is enabled for your organization. For more information, see xref:access-management::enabling-einstein.adoc[Enabling Einstein for Anypoint Platform].
292+
* You have accepted the terms and conditions for using Einstein generative AI.
293+
* Your Anypoint Platform organization is current and active.
294+
. If you are the organization administrator, verify that:
295+
+
296+
* The Salesforce organization connected for requests has generative AI enabled.
297+
* The Salesforce organization has an xref:access-management::trusted-salesforce-org.adoc[established tenant relationship] with your Anypoint Platform organization, and the connection is enabled.
298+
* The Salesforce organization is valid and not expired or disabled.
299+
300+
[[troubleshoot-metadata-errors]]
301+
==== Metadata Errors
302+
303+
Metadata errors occur when the input or output metadata provided to *Map with AI* or *Map and Transform with AI* is invalid, missing, or improperly structured.
304+
305+
If you receive a metadata error:
306+
307+
. Verify that both input and output metadata are provided when using *Map with AI*.
308+
+
309+
*Map with AI* requires both input and output metadata to perform automatic field-to-field mapping.
310+
. Check that your metadata structure is valid:
311+
+
312+
* Ensure the metadata follows the expected schema format.
313+
* Verify that required fields are present in the metadata.
314+
* Confirm that data types match between input and output metadata where applicable.
315+
. Review the metadata source:
316+
+
317+
* If metadata is generated from sample data, verify that the sample data structure is correct.
318+
* If metadata is imported from an API specification, verify the specification is valid and complete.
319+
* Refresh metadata by clicking *More Actions* in *Transformation Builder* and selecting *Refresh metadata*.
320+
. For *Map and Transform with AI*, verify that:
321+
+
322+
* Input sample data is provided and valid.
323+
* Output sample data is provided and valid.
324+
* Sample data formats match the expected MIME types. See <<sample-data>> for supported formats.
325+
326+
[[troubleshoot-request-limit-errors]]
327+
==== Request Limit Errors
328+
329+
Request limit errors occur when you exceed the rate limits for GenAI API requests. These limits help ensure fair usage and system stability.
330+
331+
If you receive a request limit error:
332+
333+
. Wait before retrying your request:
334+
+
335+
* The error message indicates when you can retry the request.
336+
* Avoid making multiple rapid requests in succession.
337+
. Reduce the frequency of AI-assisted transformation requests:
338+
+
339+
* Batch multiple transformations when possible.
340+
* Use manual mapping for simple transformations to reduce API calls.
341+
. Contact your Anypoint Platform organization administrator if:
342+
+
343+
* Request limits are consistently reached during normal usage.
344+
* You must understand your organization's specific rate limits.
345+
. Consider alternative approaches:
346+
+
347+
* Use *Manually Adding Data Sources and Targets* for straightforward mappings. See <<manually-add-data-sources-targets>>.
348+
* Write DataWeave scripts manually for complex transformations that don't require AI assistance.
349+
350+
[[troubleshoot-general-ai-errors]]
351+
==== General AI Errors
352+
353+
If you encounter other errors with AI-assisted transformations:
269354

270355
. Log in to Anypoint Platform and try again.
271-
. Ask your Anypoint Platform admin to verify that generative AI is enabled for your organization.
272-
. If you're logged in to Anypoint Platform, and your organization has access to Einstein generative AI, accept the terms and conditions for using Einstein generative AI.
356+
. Verify that your Anypoint Platform organization has access to Einstein generative AI.
357+
. Ensure you have accepted the terms and conditions for using Einstein generative AI.
358+
. Check your network connection and try again.
359+
. If the error persists, contact your Anypoint Platform organization administrator or MuleSoft support.
273360

274361
[[manually-add-data-sources-targets]]
275362
=== Manually Adding Data Sources and Targets

0 commit comments

Comments
 (0)