Search code examples
mulemule-studiomulesoftmule-esb

how to read a property's value of value in Mule4?


I have a property defined in properties file.Note client1 prefix, which is calculated dynamically when request hits.

client1_appilicationid=OBCDSEFT

i have 2 variables defined in my flow;

<set-variable value="#[attributes.headers.'x-client-id']" doc:name="ClientId" doc:id="1e33f179" variableName="clientid"/>

Here attributes.headers.'x-client-id' =client1

<set-variable value="'#[vars.clientid]'++'_'++'applicationid'" doc:name="applicationId" doc:id="9df0420e" variableName="applicationid"/>

In the above if i access #[vars.applicationd] it will print client1_appilicationid as value. but i want 'OBCDSEFT' as value. How I can define applicationId variable to get that?


Solution

  • You are just concatenating the client id header value with the suffix, however that will not read a property value. You should use the p() function to read properties values.

    The expression should be something like this: #[p(vars.clientid++'_'++'applicationid')]