Calling a Logic App from Another Logic App (Nested Logic Apps)

This blog gives information about creating or establishing a parent-child relation in Logic Apps in the designer. In simple words calling one logic app inside an another logic app.

Purpose of Nested Logic Apps:

The major advantage of this feature is to create reusable pieces:

  • Archiving source file is a common process in all file processing applications.
  • Decryption of the encrypted file or vice-versa
  • Sending an alert mail on failure

Lets create TWO Logic Apps to demonstrate this and call them as

  • PARENT Logic App – The Logic App that will call the another Logic App.
  • CHILD Logic App – The Logic App that will be called from PARENT.

If you want to Invoke CHILD Logic App from another Logic App, it should start and end with below mentioned trigger and action respectively:

  • The Child Logic App should have its Trigger to be Manual – When a HTTP request is received”
  • The Child Logic App must and should end with a “Response” action.

Creating Child Logic App:

  • Login to Azure portal using your credentials.
  • Navigate to your resource group using Resource groups option and then click on Add or Create resources.
  • Type Logic Apps in the Marketplace search box and then click on Create.
  • Provide all the required details like Name, Subscription, Resource Group, Location and then click on Create to start the deployment of Logic App.
Image 01: Snapshot Showing the required details to create a Logic App.
  • Now navigate to the Logic App Designer of ChildLogicApp and type for Request Trigger in the “Search Connectors and Triggers” search box.
Image 02: Snapshot Showing the Trigger to select for a CHILD Logic App
  • Here it trigger manually means that it will trigger through a HTTP post, which in turn means that we need to provide some request body. Let consider the below JSON message for the request.
Image 03: JSON Message for request
  • You can avail “Use Sample Payload to generate schema” option in the trigger to generate the JSON Schema for your JSON message automatically.
Image 04: JSON Schema generated using inbuilt option marked
  • Now complete the Logic App with necessary Actions for archival process as per your requirement. Here I am just making the CHILD Logic App to display the name of the SourceFileName that sent from PARENT Logic App for archiving and the final app will look like as the one shown below:
Image 05: Assigning SourceFileName coming from the Trigger using Add Dynamic Content to a Variable
  • **We will create a Response Action later in this Logic App, lets create a PARENT Logic App to call this CHILD by following the steps.

Creating PARENT Logic App:

  • Use the similar steps to create PARENT Logic App as shown above and then to call the CHILD Logic we need to search for Logic Apps in the action search bar and select the option as shown below:
Image 06: Showing to how to call CHILD logic app from parent using Logic App action
  • When you select Choose a Logic Apps workflow option, it will list all the available Logic Apps (which has Manual Trigger) in the resource groups of your subscription. Select the appropriate one as shown below:
Image 07: List of all available Logic Apps with Manual Trigger
  • After selecting the ChildLogicApp Logic App you can see the request which you provide in the CHILD Logic App’s JSON schema there in that action i.e SourceFileName.
Image 08: Snap showing the Request of CHILD Logic App in PARENT Logic App
  • Here in the above snap, I am sending the text from PARENT Logic App that I want to assign it to a variable in the CHILD Logic App. Now run the Parent Logic app and see the run details.
Image 09: PARENT Logic App Run Details – ChildLogicApp action Failure
Image 10: CHILD Logic App Run Details – All Actions Succeeded
  • You can see the Parent Logic App successfully called the CHILD Logic App and then the CHILD Logic App assigned the value we passed from parent to the variable as expected.
  • But if we see the PARENT Logic App Run Details (Image 09), even though the CHILD Logic App got succeeded (Image 10), the action in PARENT got failed with a error saying “To wait on nested workflow, child logic app will contain a Response action”.
  • This is because the PARENT Logic App’s action where we called the CHILD logic app will expect the response from it for further processing, otherwise it will assume that CHILD got failed and it will fail the action.
  • So we have to send a Response from the CHILD logic app saying that it got executed successfully. Now let go and create a Response action in the CHILD Logic App just by searching for response in the action’s search bar and it will looks like as shown below:
Image 11: CHILD Logic App after addition of Response
  • You can provide the response body in JSON format by just clicking the add new parameter option. Save the Logic App and trigger the PARENT Logic App again and see the run details now.
Image 12: Snapshot showing the Success of the PARENT Logic App
Image 13: Snapshot showing the CHILD Logic App Run Details – Sending the Response to PARENT Logic App
Image 14: Snapshot showing the PARENT Run Details – Successfully captured the Response send by CHILD

For Your Information:

  • The CHILD will always send the status code – 200 if all the previous actions will run successfully, if some action failed before the response, the status code will be different and it will fail the PARENT ChildLogicApp action.
  • To test this scenario, I am manually pass a response code – 456 in the CHILD Logic App and triggered the PARENT and the run details will be as shown below:
Image 15: CHILD Logic App Response Change to 456
Image 16: PARENT logic App Run Details
  • We can see that the PARENT Logic App got failed with the changed response in the CHILD Logic App.

I hope the blog was clear about creating Nested Logic Apps, please feel free to share your valuable feedback to improve this blog.

Thanks for reading…! Happy Learning…!

Published by Hemanth Reddy

ETL Developer @Leading Torch India Pvt Ltd

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create your website with
Get started
%d bloggers like this: