1,999 questions
0
votes
2
answers
79
views
How to send a literal time to a Salesforce Time field from DataWeave without timezone conversion?
I'm using MuleSoft to send data to a Salesforce custom object. My object has a field named Shift_End_Time__c, and its data type is Time.
My source system provides this time as a string in UTC format, ...
1
vote
1
answer
108
views
How to extract and clean JSON payload inside CSV field from multipart data in MuleSoft DataWeave 2.0
I am working in Mule 4 using DataWeave 2.0 and trying to transform a multipart/form-data payload that contains a CSV file.
Here is a simplified example of my input payload (multipart):
----------------...
0
votes
1
answer
119
views
MuleSoft DataWeave Date Time Formatting
Using input payload of
{
"Date": "2025-09-09T18:03:06.830"
}
I'm trying to get an output of
"2025-09-09T18:03:06.830Z"
I've tried this DataWeave
%dw 2.0
output ...
3
votes
2
answers
243
views
Process .DAT files which contains PDF
I will be receiving a .dat file which contains multiple pdf files encoded as base64 string which will be separated by a new line or some character.
Initial approach is read -> payload splitBy “\n” -...
0
votes
1
answer
52
views
Can I extend Dataweave with additional Scala-based functions/libraries?
I have some functions written in Scala that I would like to add to Dataweave in Anypoint Studio so that I can use them natively in Transform connectors. Is it possible to extend Dataweave's core like ...
0
votes
1
answer
91
views
Using MuleSoft Transform message initialize variables when payload is null
I am using the MuleSoft Transform Message component to initialize variables testIP and testDomain. It works well when the payload is not empty, but throws an exception when the payload is null or ...
0
votes
2
answers
53
views
How to get all elements with key ending with TXI to an array
I need to get all elements which has key ending with TXI, to a single array using simple 1 or 2 lines.
Tried various ways using mapObject(), However it doesn't work with the nested structure. Also ...
-1
votes
1
answer
76
views
How to stream lines of text from large file using Mule 4.5.0 Kernel
Using Mule 4.5.0, I need to read in a large text file (~1GB-2GB) line by line (/n) and generate individual mule messages of each line. Using dataweave and the foreach scope I was able to stream the ...
2
votes
2
answers
67
views
Append to a matched regex string
Using dataweave with import * from dw::core::Strings
I have converted a JSON payload into a plain text string. I am able to use the Java functions replaceAll, match, etc. with a regex pattern to find ...
-2
votes
2
answers
82
views
Dataweave / Mule : CSV to JSON - 3 level Hierarchy Issue [closed]
Source Data : Here is the CSV Data (4 Records):
EMP_ID,DEPT_ID,OPRT_UNIT_CODE,PROD_CODE,NODE_CODE,ALLOC_PCT
123456,00700,0101,000,00700-0101,5
123456,00700,0101,000,00700-0101-000,5
123456,02150,0101,...
1
vote
1
answer
91
views
How to access a property name in URI params in Mulesoft
I'm trying to access a property in HTTP Request connector URI Params, But it doesn't seem to be working
Here's the way I generally access ${property_name} in all the places, but it's not resolving the ...
0
votes
1
answer
51
views
How to merge two lists based on a matching string and assign incremental numbers to each object using Mulesoft DataWeave
How can I merge the following two lists ids and attributes based on the matching did field and for each matched pair increment the iterid values
For example I have two lists below. size of the list ...
1
vote
1
answer
96
views
Translate UTF-8 punctuation with normal ascii punctuation marks
I'm trying to cleanup a raw data that has embedded \r\n or \n in csv lines.Line terminator is \r\n.
trying to translate utf-8 punctuation marks to normal ascii punctuation marks.
cleaning up any ...
0
votes
1
answer
136
views
Should I go with if-else or match-case in the below scenario?
I have my input as json, where I have to derive the quantity based on one field shippingNode.
Mapping: data/availableQuantity/supplyQuantity
The conditions are as below
If shippingNode is starting ...
-1
votes
1
answer
85
views
JSON to CSV via MuleSoft DataWeave - Okta App data
I was struggling to get a DWL script going, given the following JSON data from Okta's API.
Search for only "signOnMode" JSON array items that equal to "SAML_2_0", and ignore/skip &...
1
vote
1
answer
92
views
Remove data inside the arrays of an XML
I need to remove everything thing starting with "[@" and ending with "]" in the given XML. The text that falls in-between these sqaure brackers should also be removed. I tried the ...
0
votes
1
answer
57
views
XML attributes being lost after adding namespace prefix to an existing XML
I need to add namespace and prefix(ns0) to the root tag of an existing XML. I tried doing it with the piece of code below. However the output has removed all the existing attributes that were already ...
0
votes
1
answer
106
views
JSON conversion to XML using attributes and namespaces
I have a JSON payload that I need to convert into an XML. However that JSON payload has many fields starting with '@' which are supposed to be the XML attributes. So when I converted those into XML ...
1
vote
1
answer
87
views
How to sum values of same keys from objects in an array using Dataweave
The first key should remain as is, and the rest should be added as below output. The slash "/" is required at the end.
This is just an example, the DataWeave script needs to be dynamic.
...
1
vote
1
answer
213
views
Using the DataWeave update operator, how can I target a nested node with a dynamic reference?
I'm trying to use the DataWeave update operator to either modify or delete a nested node in a JSON payload. The node's path will be passed dynamically and will change, so it can't be hardcoded.
The ...
1
vote
1
answer
112
views
Mulesoft Dataweave use a variable as item in a selection at a JSON object
I want to do a selection on an item based on a (yaml) property in Dataweave. I have this code:
%dw 2.0
var testWithProperty = p('incoming.var')
// incoming.var refers to the value "resultSet&...
0
votes
1
answer
77
views
Mule 4 convert a string with an Array of enclosed Json Objects into individual Json objects
[
"{ "Context" : [ { "PeriodOfServiceId" : "30000020", "PersonName" : "LANA, LANA", "PersonNumber" : "259", &...
0
votes
1
answer
255
views
not able to modify errorType from error object in mule 4
I want to modify error.errotType to something else. How can I do that? I do not see any option to update error object in Mule 4.
Also why in 'raise-exception', type field can not be set dynamically i....
0
votes
1
answer
101
views
How to loop through the attributes inside the XML and update its value?
I have an XML where I want to find a particular attribute 'type' shiprefnum under ReferenceNums->Reference and replace the value to 124215133_AB_00010.
Input XML:
<?xml version='1.0' encoding='...
1
vote
1
answer
107
views
How to retrieve the second XML element with a specific attribute value in DataWeave 2.0
I am working with MuleSoft DataWeave 2.0 to process an XML payload. I need to extract the second <wd:ID> element where the attribute wd:type equals "Learning_Course_ID".
Here is a ...
0
votes
2
answers
180
views
How do I get the year from a date in a Mulesoft dataweave expression
Date: |2000-03-29|
this is what I am trying but getting an error:
type LocalDateFormat = LocalDateTime { format: "yyyy-MM-dd'T'HH:mm:ss" }
fun myDate(myDateString: DateTime) = (
if(...
0
votes
1
answer
111
views
Variable Output Type in Transform
In the example below, When I create variable in Transform, I sometimes use application/java
and some times use application/json . It seems that the target system using this variable doesn't care
...
0
votes
1
answer
167
views
DataWeave in Apex - Dynamically specify the SObject Class
I have a DataWeave script that is working wonderfully. I'm using it inside of an Apex Class. Again, works great. Here is it:
%dw 2.0
input csvData application/csv
input fieldMappings application/json
...
0
votes
1
answer
91
views
DataWeave Dynamic Mapping CSV to JSON objects
I have a Dataweave script based on an example from Mulesoft https://docs.mulesoft.com/dataweave/latest/dataweave-cookbook-map-based-on-an-external-definition
I am trying to map the contents of a CSV ...
0
votes
1
answer
243
views
Convert XML to JSON with Attributes and Text as Keys Without __text
I have a payload in XML format, and I need to convert it to JSON. The XML contains many key-value pairs and also a lot of attributes, and I need those attributes to be included in the JSON as well.
&...
0
votes
1
answer
111
views
Trying to parse XML payload but getting an error : You called the function 'Descendants Selector ..' with these arguments: 1: String ("")
Am trying to parse an input XML payload and transform and generate a response XML.
Here is my input XML
<?xml version='1.0' encoding='UTF-8'?>
<EmployeesInfo>
<EmployeeDetails>
...
0
votes
1
answer
106
views
Call a function with NULL input
I have defined a DataWeave function that takes a string as input and can handle null input as well. However, when I call it with null input, I encounter a syntax error. Could anyone tell me why? ...
0
votes
1
answer
90
views
Function issue using if else and try catch
I need a dataweave function which extract fix string to convert it into ISO Date String format
fun convertToISO(dateString: String): String =
if (dateString == null)
""
...
0
votes
1
answer
94
views
How to keep the updates applied in a payload iterating in a map
I Have a issue in my code and I dont know how to solved, I explaint the situation, I have two arrays of objects; The Payload we need to do a loop and if it math with an item in the array named ...
0
votes
4
answers
158
views
How to write a function filter an object from incoming array using dataweave?
Given an array shown below
array:
{
"documentToSigner": [
{
"documentName": "ESRA For aa aa",
"typeCd": "...
1
vote
3
answers
104
views
How to create an array based on keys after the filter condition?
I have a array as shown below which is an output of the filter condition. It has fields like documentItemName1,documentItemName2,documentItemName3 at the min it can have on and max of 3.
It's like for ...
-1
votes
1
answer
135
views
Mule function that using match with a regex what kind of string does the function accept?
can anyony help me with what is the expeted input string that would be accepted by the regex in this method?
Message = input is a string
fun getId(Message) = (Message match /betalning_maltid_\{id:([0-...
0
votes
1
answer
151
views
How to sort json data in Mule 4 Dataweave
I need to sort JSON data which can contain array as well as objects
sample data :
{
"results": [
{
"empCode": "abcd",
"age&...
0
votes
1
answer
171
views
MuleSoft Dataweave JSON to XML, reintegrating attributes from writeAttributes=true
I converted an XML snippet to JSON using the writeAttributes=true property.
XML:
<family surname="Simpsons">
<father age="42">Homer</father>
<mother age=&...
0
votes
0
answers
113
views
Failed to resolve variable outboundHeaders type expression --mule flow error at IDE (anypoint studio)
My IDE (Anypoint studio ) complains with the flow code and throw error message as below
But actually code is working, mvn build is also working. Does anyone have idea to get rid of this annoying error ...
1
vote
2
answers
176
views
Using String manipulation functions in Mule <logger element
I need to print a portion of the String variable value to the Mule console using Mule <logger>. I am not sure if it is possible to use substring function within the logger. However, when I tried ...
0
votes
1
answer
152
views
How to separate an array in dynamics arrays to not exceed the value indicate with DWL
I try to explain you, I have an Array of Objects:
Input:
[
{ "number": "000001", "price": 14.99, "qty": 18, "line": "3" },
{ "...
0
votes
2
answers
87
views
Convert the dollar amount value to a number format before sending it to Excel
In MuleSoft, convert the amount value into USD format like $3,567.00, but send the list of amount values to the Excel sheet as number so that Excel can calculate the total using the SUM() function
I ...
0
votes
0
answers
111
views
Mulesoft, Convert excel data (application/xlsx) into byte [] format
In MuleSoft, How to convert excel(mime: application/xlsx) data into byte[] format
Please suggest the logic, as Binary {class: “byte[]”} it’s not working for xlsx data
0
votes
1
answer
185
views
How to remove namespace from XML in dataweave [duplicate]
Need to remove namespace from XML by keeping everything else as is including the attributes. I tried using replace and update but it does not seem to work. Below is the sample XML where I need to ...
0
votes
1
answer
94
views
Sorting nested array with a specific list with dataweave
Sorting an array is correct, but result is not correct with a nested array.
I tried with a simple array, output is correctly sorted.
%dw 2.0
output application/json
import indexOf from dw::core::...
0
votes
1
answer
388
views
Convert a string date in UTC to AEST
I am trying to convert a date in string format in UTC timezone into Australia/Sydney timezone. It seems to work for one value, but not the other, so I am a little confused
%dw 2.0
import * from dw::...
0
votes
0
answers
50
views
Identifying Dataweave functions/ modules based on Dataweave Class names in Heap Dump
I have an app which is failing with out of memory issue and created a hprof file during load. Heap Dump Histogram
I have tried to analyse the hprof using jhat and got below histogram view from it.
I ...
-2
votes
2
answers
134
views
How to format a given string of numbers to the Russian currency format?
I have the following input JSON
{
"listPrice": "1245678.98"
}
I need to format this to the following format
{
"listPrice": "1 245 678,99"
}
Currently i'm ...
-2
votes
2
answers
99
views
unable to use password from property file in mule 4
I am not able to use the below mentioned password from property file in mule4.
I am trying like ${db.password} and database connectivity is failing but hardcoded value is working fine. Is it because ...