How can you call a flow from Dataweave?
How can you call a flow from Dataweave?
To call a flow from Dataweave, you can use the Lookup function. The Lookup function dynamically evaluates and executes a flow by its name and optionally allows passing parameters. It is specifically designed for calling other flows within Dataweave scripts.
The lookup function is of very specific use, the mule's documentation indicates using the flow reference with the target. "MuleSoft recommends that you invoke flows with the Flow Ref (flow-ref) component, using the target attribute to put the result of the flow in a var and then referencing that var from within the DataWeave script." Reference: https://docs.mulesoft.com/mule-runtime/4.3/dw-mule-functions-lookup
Yes, good observation. The Lookup functions now seems to be deprecated, according to MuleSoft's documentation, and what you quoted is the recommended way to do it instead. There are probably no more questions about the Lookup function on the exam anymore.
{a: lookup("myFlow", {b:"Hello"})}