How to use p() function in Dataweave to read property file

How to use p() function in Dataweave to read values from the properties file



Using p() function in Dataweave we can read values from Mule property placeholders, System properties, and Environment properties. To read values from Mule properties file using Dataweave we can use p() function which is an external function.

The syntax for p() function in Dataweave Mule 4:


#[Mule::p('http.port')]

To define a variable in Dataweave whose value is fetched using p function
#[var myVar = Mule::p('http.port') --- myVar]

The syntax for p() function in Dataweave Mule 3:


#[p('http.port')]

To access a property defined in the secure property placeholder use the following syntax:
p('secure::myproperty.name')

Differences in ${} and p()



  • ${} is used in both MEL and Dataweave while p() is limited for Dataweave use


  • p() can take flow variable as argument. p(flowVars.name) or Mule::p(vars.password) - Mule 4


  • The argument for p() can be derived from concatenation also, but not for ${}. p(flowVars.name ++ "lastname")



Post a Comment

0 Comments