Workflow cannot be used as a child workflow because child workflows only support embedded connections
Have you seen that huge warning, when trying to add a newly created Power Automate flow as a child flow, saying:
The workflow with id <ID>, name <NAME> cannot be used as a child workflow because child workflows only support embedded connections.
Looks scary! What does it mean? How to fix it? Let me show you!
Child flows
Child flows were introduced to Power Automate by the end of October 2019 (https://docs.microsoft.com/en-us/power-platform-release-plan/2019wave2/power-automate/call-child-flows). They gained quickly positive feedback, as they let you to easily create multiple patterns in Power Automate such as state machine or long running approvals.
The other highly desired scenario that is possible to be created with Child Flows is elevation of permissions, as I described it here.
To create one, simply build a flow that is triggered by manual action and then finish with “Response to PowerApps or Flow” action:
Add action
Important! To be able to call flow as a Child Flow, both the Parent and the Child Flow must be in a Solution.
The error
When you create a flow, that you want to use as a child flow, and you use in it actions that uses connections (eg. to SharePoint or Outlook), then when trying to add that flow you will see the following, long and very scary error:
Request to XRM API failed with error: 'Message: Flow client error returned with status code "BadRequest" and details "{"error":{"code":"ChildFlowUnsupportedForInvokerConnections","message":"The workflow with id '<ID>', name <FLOW NAME> cannot be used as a child workflow because child workflows only support embedded connections."}}". Code: 0x80060467 InnerError: Type: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]] Message: Flow client error returned with status code "BadRequest" and details "{"error":{"code":"ChildFlowUnsupportedForInvokerConnections","message":"The workflow with id '<ID>', name <FLOW NAME> cannot be used as a child workflow because child workflows only support embedded connections."}}". StackTrace: at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.Update(Entity entity, InvocationContext invocationContext, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, Boolean checkForOptimisticConcurrency, Dictionary`2 optionalParameters) at Microsoft.Crm.Extensibility.OData.CrmODataExecutionContext.Update(Entity entity, UpdateOption updateOption) at Microsoft.Crm.Extensibility.OData.CrmODataServiceDataProvider.UpdateEdmEntity(CrmODataExecutionContext context, String edmEntityName, String entityKeyValue, EdmEntityObject entityObject) at Microsoft.Crm.Extensibility.OData.EntityController.PatchEntityImplementation(String& entityName, String key, EdmEntityObject entityDelta) at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func, IEnumerable`1 additionalCustomProperties) at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func`1 func) at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext() InternalException: '.
The reason? Simply – the connections you use and are defined inside the child flow are embedded. What it means? This means, that when calling that flow it would still try to get user context to execute the connections, not use the ones defined by the flow’s author. So in the end – the flow cannot be added as child flow because in such scenario user context is lost and the flow is expecting it to have. And embedded connections, by default, can only be executed by the flow owners. So you need to define, who can use them.
The solution
Go to your flow that you want to add as a child flow. Open its details page. Then hit “Edit” in the “Run only users” box:
Each connection you have defined in your flow is by default set to be run by the current user (1). To fix the issue, change it to use one of the defined connections, so that it won’t need the user’s context (2):
Once that done, go back to your parent flow and try to save it again. Issue is resolved!
I hope this short post will help you. In case you have any questions, simply leave a comment 🙂
Comments
-
Workflow cannot be used as a child workflow because child workflows only support embedded connection
Are you sure your flow is triggered via "Manual" trigger? And also - to use the "Child flows" functionality, flows must be put within solutions.
-
Workflow cannot be used as a child workflow because child workflows only support embedded connection
What if I dont have this 'Run Only suers' option?
*This post is locked for comments