malteser
malteser

Reputation: 485

Setting variables from Mule 4 Script (Groovy)

Previously in Mule 3.x.x, we would be able to set variables from within a groovy script using. message.setInvocationProperty("name", "value").

I cannot seem find a way to do this anymore. I am aware that the mule message structure has changed, but is there a way for one to set variables/attributes from a Mule 4 script similar to the way we could in Mule 3?

Thanks in advance.

Upvotes: 0

Views: 1647

Answers (1)

Ryan Carter
Ryan Carter

Reputation: 11606

No, in Mule 4 you cannot modify vars directly.

You can set the return value of the script to go directly to a variable though using the target attribute, with it's value being the name of the variable:

<scripting:execute engine="groovy" target="myVar">

Probably best as well - to keep the script decoupled from mule specifics.

Upvotes: 1

Related Questions