Search code examples
mulemule-componentmule-esb

vars is not evaluated in the body of http requester in Mule 4


How to pass the value of variable (Vars) in body section of http requester in Mule 4?

For example : I want to construct a string like below in the body of http requester

{"Script":"Select ID from Student where StudenName = 'tom'"}

The student name in where condition should be a variable. I tried below but the value of vars.name is not getting replaced during runtime .enter image description here


Solution

  • You've got it inside quotes. This should work

    #[{"Script":"Select ID from Student where StudentName = '" ++ vars.name ++ "'"}]