'Power Automate: Run a child flow by GUID

I'm trying to call a child flow from a Power Automate flow by it's guid (by using an Expression in the Child Flow dropdown), instead of hardcoding the child flow selection.

However, whenever I try to save the parent flow, I get the following error:

Request to XRM API failed with error: 'Message: Flow client error returned with status code "BadRequest" and details "{"error":{"code":"ChildFlowIdNotValid","message":"The workflow id '[[expression]]' is not a valid child flow id. The id must be a valid GUID."}}". Code: 0x80060467

I tried various expression, even simple stuff like @guid() (which is definitely a valid guid), but to no avail.

It seems like the platform performs a "compile time" check on the value, which makes using any dynamic value impossible.

Any ideas?



Solution 1:[1]

I think that Run Child flow action is designed to be more interactive than programmable, unfortunately. Interacting with the Run Child Flow action calls an API, and the response is used to modify the action definition. Whatever is the "custom value" expression - it is not evaluated, but instead read as string, and used in a call to retrieve the sample header. That sample is then used to re-format the Run Child Flow action to show the appropriate headers. Having an undetermined target would mean the call body is not defined, which could be a problem. Interestingly, it does pop a spot for a body when initially trying to look for a hard-coded GUID.

You can see the after-effect of this behavior in how even hardcoded GUIDs get replaced with the flow names once saved/reopened.

As a workaround, I stack Run Child flows in a Switch action checking an expression result. I.e.:

Switch workaround

Side note - GUID() in Azure Logic Apps (and powerautomate) does not format an arbitrary string as GUID.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Andrey Yakimov