Decouple the Flow from The Power App to prevent end-user Authentication Using a Child Flow

In my previous blog post, we worked around the problem of Power Apps prompting for credentials during deployment by decoupling the Conversion logic of Power Automate(Microsoft Flow) from the Power App by writing the data to SharePoint. We then used the full version of Power Automate to attach the Flow, which does all the work, to the SharePoint list or library.

In this post, I will explain how to apply the same principle without using SharePoint as an intermediate by using a Child Flow instead.

  • A child Flow: This is the Flow that is nested inside the parent Flow and it will contain the logic to Convert HTML to PDF.
  • A parent Flow:  This Flow will be Triggered when we click on the button from Power Apps and will call into the child Flow.

If you prefer to watch the following steps being completed instead of reading through them, please just view the video below:


Creating a ‘Solution’.

  • Navigate to https://make.powerapps.com/.
  • Click on ‘Solutions‘ from the left navigation.
  • Provide a Display Name, Name, Publisher and Version.
  • Click ‘Create‘ once these values have been provided.

Power Apps 
Home 
Learn 
Apps 
+ Create 
Data 
Flows 
Chatbots 
Al Builder 
Solutions 
+ New solution 
Solutions 
Display name 
New solution 
Display name 
Muhimbi Decouple 2 
Name • 
MuhimbiDecouple2 
Publisher 
Muhimbi Decou 
muhdeveloper 
Solution 
Edit publisher 
solutions 
Version 
Contextual Help 
1.000 
Contextual Help 
More options v 
Power Apps Ch 
Power Apps Ch 
Microsoft Flow 
Microsoft Flow 
Create 
Cancel



Creating the ‘Power App’

  • In the Solution, Click on ‘+ New‘ , ‘APP‘, ‘Canvas app‘ and select the layout of your Choice.


u onejn6guO) dyqsuoqm auouoduo) uognps 
•Bed dlOH 
MOE 
suognps 
awqd 
dde ua,yjp.pp01N 
ddp senue) 
SOO!VIIOS I 
wappng IV 
sddv 
unm 
sddv


  • On the Power Apps Canvas, add a Camera control, Text Input and a Button.
  • On the Button, ‘OnSelect‘ property, associate the Formula below.


	Collect(
	    Controlcollection,
	    {
	        Name: TextInput1.Text,
	        Image: Camera1.Photo
	    }
	);
	Set(
	    JSONVar,
	    JSON(
	        Controlcollection,
	        JSONFormat.IncludeBinaryData
	    )
	);
Clear(Controlcollection);MainFlow.Run(JSONVar)


Pow« Apps 
Home View 
Tree View 
Screens Components 
muhimbisupport (default) (org3 „ 
Decouple • Saving. | 
Col (Control collection , {Name: Text Inputl . Text , Image : C:meral . Photo}) ; Set( DSONVar, 
Format text 
Remove formatting


Configuring the ‘Parent Flow’.

  • Add the ‘Power Apps‘ Trigger.
  • Add the ‘Initialize variable‘ action and click on ‘Ask in Power Apps’.
  • Add the ‘Run a Child Flow‘ action (Navigate back to the Solution and add another Flow to the solution).


No additional information is needed for this step. You win be •ble to use the in 
Steps. 
{x} 
Initialize vanable 
Run Child Flow


Configuring the ‘Child Flow’.


  • Step 1 : Add the ‘Manually Trigger‘ a flow action and add a variable XHTML of type String.
  • Step 2 : Add the ‘Compose‘ action and add the ‘XHTML‘ the output of the ‘Manually Trigger‘.
  • Step 3 : Add the ‘Parse JSON‘ action and in the ‘Input’ pass the ‘XHTML‘ the output of the ‘Manually Trigger‘.
    • Click on ‘Generate from sample‘ and copy the output from the ‘Compose‘ action and Generate the ‘Schema‘.
  • Step 4 : Add the ‘Initialize variable‘ action, and ‘Name’ – HTML, ‘Type’ – String.
  • Step 5 : Add the ‘Set variable’ action, and set the HTML below:
<h1>@{items('Apply_to_each')['Name']}</h1>
<img src='@{items('Apply_to_each')['Image']}'>
Note: Apply to each loop will be added automatically.
  • Step 6 : Add the ‘Convert HTML to PDF‘ action and pass the ‘HTML‘ variable to ‘Source or HTML‘.
  • Step 7 : Add the SharePoint ‘Create File‘ action and create the File in SharePoint.
  • Step 8 : Add the ‘Respond to a Power Apps‘ action and Pass the text ‘Your file is created in SharePoint‘.
  • Step 9 – Save the ‘Child Flow‘.

Now when you, Save the ‘Main Flow’ it will show you a Error(Very Important!).

v Errors O) 
v Run a Chit Flow (1) 
the child for action 
Run-a-Chld_Flow' to not use •run-only user' 
v Warnings (C)


Navigate back to your ‘Child‘ Flow on the management screen, click on ‘Edit‘ for the ‘Run only users‘.

「 一 0 一 Child ow or 一 , , 9 一 0 PDF 
0 
0

  • In the ‘Run only users‘ section select the Connection from the drop down.

Manage run-only permissions 
Invite system users or teams 
Let others run this flow and see the results. but not edit in any way. 
Enter names or email addresses 
Currently shared with 
This flow has not been shared with any users. Add a person aryl see their 
name here. 
Connections used 
These connections will provide the users listed here to have run-only access 
to this flow. unless providing their own connection, run-only users '"Il not 
have access to these connections outside this flow. 
Muhimbi PDF 
Run-only users will be asked to provide their own 
connection to this connector. 
Provided by run-only user 
SharePoint 
Run-only users will be asked to provide their own 
connection to this connector. 
Provided by run-only user 
Cancel
  • Navigate back to you Main Flow, and now you should not see the Error about ‘Run a child Flow‘.  All done! It’s now time to test our Solution.
  • Navigate back to you Solution and Share the Power Apps with your end-users

Share Decouple Demoed 
x 
Add people as Users and Co-owners to your app. Make sure your data connections have been shared with all users. 
canbedeleted 
Enter a name, email address. or Everyone 
This user can use this app. 
Co-owner 
Can use, edit, share app but not delete or change 
owner. 
Data permissions 
Make sure your users have access to the data used in 
your app, including gateways, APIs, connectors, and 
Shared with 
canbedeleted 
user 
test_clavin 
Owner 
Sort by Name v 
x 
entities. 
Logic flows 
Share 
Cancel

Now when your End user launches the APP, he will not get the Muhimbi Sign-in Prompt.

Almost there 
Decouple Demoed needs your permission to use: 
Camera 
Allow 
Don't Allow

Fill in the details in the Power App, click on the Submit button and after a few seconds, you should have a PDF in your SharePoint Folder.

Subscribe to this blog for the latest updates about SharePoint Online, Microsoft Flow, Power Apps and document conversion and manipulation.


Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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