Flow Exchange

Please login or click SIGN UP FOR FREE to create your FlowUG account to join this user group.
Expand all | Collapse all

Can two Flows be associated with one button

  • 1.  Can two Flows be associated with one button

    Silver Contributor
    Posted 11 days ago
    Hi,

    I have two Flows, to send metadata along with an image to a SharePoint List and  - to send an HTML to a OneDrive folder.  Currently they are activated using two separate buttons that are on different screens in my PowerApps application.

    The Flow that sends the HTML basically creates an ID badge.  It currently is created via a search screen and is in a gallery.  I now need this action to be performed as soon as the new visiting details have been entered as well with the Search function..

    I'm thinking of linking this Flow with the 'Upload' button which already as the Flow for sending the Metadata and image to SharePoint.
    I know there are limits to the number of Flows a user can send and as this is the main Flow, a single Flow would be the sensible solution.

    Firstly can two Flows be associated with one Button?

    Can the two Flows, currently working, just be merged into one Flow?



    ------------------------------
    Chris Clark
    Test Analyst
    ------------------------------


  • 2.  RE: Can two Flows be associated with one button

    Bronze Contributor
    Posted 11 days ago
    You can absolutely trigger two flows with the same button...just need to put a semicolon between them as you would any time multiple actions are in the same formula. If you already have the formula (e.g.: FLOW_NAME.Run(parameters-to-pass-to-Flow)), just copy that from one formula and paste it into the other (again, separating with a semicolon). You might (depending on the parameters you're passing to Flow) also need to adjust those.

    As for merging the two Flows...apparently the ability to copy and paste actions between Flows is coming soon. It was demoed in the Flow Pro call back in April or May, but no idea when it'll be ready for production.

    ------------------------------
    Chad Kealey
    ------------------------------



  • 3.  RE: Can two Flows be associated with one button

    Silver Contributor
    Posted 11 days ago
    Hi Chad,

    Thanks for your reply and the heads up on the merging of two flows.

    I seem to be having trouble when I select the 'button' to add the additional flow to.

    When I select the button and bring up my list of flows. I select the additional flow but this seems to overwrite the existing flow.  How would i get round this?

    See Screen shot.

    When I add 'Send Printable Form' the 'SPUploadImage Data Flow' gets overwritten.

    Flow

    ------------------------------
    Chris Clark
    Test Analyst
    ------------------------------



  • 4.  RE: Can two Flows be associated with one button

    Bronze Contributor
    Posted 11 days ago
    Chris,

    Sorry, I assumed you already had the formula to "call" the Flow somewhere else that you could just copy & paste from there. As you've discovered, when you try to call another Flow from a button (or other action) any existing formula is removed. This is a pain, but one you'll get used to. Basically, I copy the existing formula out to a text editor (Notepad works fine, but I prefer Notepad ++) so that I can paste it back into the formula after calling the second Flow. I do this mostly for conditional situations (e.g.: "If item status is Pending, run Approval Flow; if status is Rejected, run Appeal Request Flow") because it's often easier to have two separate Flows than build the conditional logic into one.​ However, for stringing together multiple Flows, it's even easier since you just need a semicolon between them.

    ------------------------------
    Chad Kealey
    ------------------------------



  • 5.  RE: Can two Flows be associated with one button

    Silver Contributor
    Posted 10 days ago
    Hi Chad,

    Sorry for any confusion that I may have caused.

    I do have a formula for both Flows.

    SPUploadImageData.Run(.......

    SendPrintableForm.Run(........

    They run from different screens within the same App.

    Can you just add a formula using a semicolon even if the Flow isn't associated with that button?

    ------------------------------
    Chris Clark
    Test Analyst
    ------------------------------



  • 6.  RE: Can two Flows be associated with one button

    Silver Contributor
    Posted 10 days ago

    Hi Chad,

    I copied and pasted the formula and added a semicolon into the property field of the button where I want the two flows to run.

    It works, sort of?

    When it runs from the SendprintableForm Flow it interacts with an HTML file, located in a Gallery,  It's part of a search function.  This adds details to a table which I have linked to certain fields using code 'ThisItem'.  (<td>"&ThisItem.FirstName& " " &ThisItem.LastName &"</td>)

    When I select the button which as the two flows they both run but only the table and the image are displayed, not the additional information from the 'ThisItem' link.

    Any ideas?



    ------------------------------
    Chris Clark
    Test Analyst
    ------------------------------



  • 7.  RE: Can two Flows be associated with one button

    Bronze Contributor
    Posted 10 days ago
    Chris,

    When you configure a button (or some other thing) in PowerApps to trigger a Flow, a data connection to that Flow is added to the App. Once that relationship is established, you can "move" that formula to someplace/something else and it'll still call the Flow because the App sees it as a data source.

    Now, based on your more recent reply, it sounds like that "SendPrintableForm" button is inside of either a form or a gallery (those are the two places/contexts in which "ThisItem" is relevant). Outside of that form or gallery, those tokens may not mean anything, or if you transfer the code to a button that's in a different form or gallery - particularly one connected to a different data source - they still won't be resolvable unless you have identically-named columns in that other source.

    For example, let's say the button is in a form connected to an "Clients" list/table and the Flow formula is passing "ThisItem.FirstName" and "ThisItem.LastName" as parameters to the Flow. You then move that formula to another form, but this one's connected to a "Vendors" list/table. If both lists/tables contain columns named "FirstName" and "LastName", then the Flow should fire and run as expected, but will draw the parameter values from the "Vendors" list/table. Is that what you want? Maybe. Maybe not. If not, then you need to find a way to get the values from that form into an object that can be referenced outside of the form (for example, a global variable - I use variable ALL the time...they're super helpful).

    So, the bottom line is that you need to think through what values you want/need to pass to the Flow and then determine how to get those values into the formula. There are many, many ways to do that and which one makes sense depends on how your data sources and App are structured, what the flow of information is, and a bunch of other factors. Without having those details, it's really difficult to provide specific guidance on resolving this issue.

    ------------------------------
    Chad Kealey
    ------------------------------



  • 8.  RE: Can two Flows be associated with one button

    Silver Contributor
    Posted 10 days ago
    Hi Chad,

    Thanks for the advice relating to the App seeing the flow as a Data source irrespective where the flow is used in the App!!

    For the information coming through using the 'ThisItem' formula.

    I'll try and explain it but it maybe become gibberish.  Sorry!

    The App is for recording Visitor,  which produces an ID badge.  The Badge requires certain information which is captured on the first screen.  Name, whose Visiting, where visiting, date, etc........ plus a photo.

    There are additional screens which need to be completed before the captured data is uploaded to a SharePoint list.  Once the consent form is signed the data is uploaded. This is when an ID badge needs to produced.  This is where I'm using the formula and HTML text from one of my other screens, the search function screen.  We have regular visitors so if they have visited prior we can just print that badge again and make any amendments necessary.  This screen contains a Gallery so 'Thisitem', as you have mentioned, works perfectly.

    Where I have both formulas for the Flows is a Form.

    Would it be possible to add a Gallery to the Form and have the required fields pre-populate and make the Gallery Visible property False.
    I'm not that clued up on variables I am learning......

    ------------------------------
    Chris Clark
    Test Analyst
    ------------------------------



  • 9.  RE: Can two Flows be associated with one button

    Bronze Contributor
    Posted 10 days ago
    So, you have a form where you can record a new "Visitor" as well as a gallery of existing "Visitors". In the gallery, there is a button to print the badge, but you want to add that to the "submit" (or "save") button used to save a new "Visitor". Is that correct?

    Also, when triggering that "Print Badge" Flow on a new item, you want to pass the user's first and last name (which are represented in the gallery in a single "HtmlText" control). Those values are also stored in fields/controls in your form, right? Let's say those text entry controls are called "txt_FirstName" and "txt_LastName" (BTW, I strongly recommend establishing a naming convention for controls in your Apps, if you haven't already). In that case, you can replace "ThisItem.FirstName" with "txt_FirstName.Text" and "ThisItem.LastName" with "txt_LastName.Text". You can access and use the contents/values stored in those controls from anywhere in the App (one of the reasons the names need to be unique). So, in that gallery, if those values are being presented in an HtmlText control called "html_FullName" (or whatever you called it), you could pass that value to the Flow as "html_FullName.Htmltext".

    Hopefully that makes sense. If not, email me (chad_at_drexel.edu) and we could try to connect through Teams (or I have a Zoom account if you don't use Teams) and I can probably help you figure this out.

    ------------------------------
    Chad Kealey
    ------------------------------



  • 10.  RE: Can two Flows be associated with one button

    Silver Contributor
    Posted 6 days ago
    Hi Chad,

    You are correct.  I have a screen for recording new visitors and another screen to enable a search for previous visitors.

    The Search screen contains a Gallery.  An HTML script is used to produce a Badge. The badge includes, currently, random details and a Image linked to that Metadata.

    A 'Button' to send the badge to a OneDrive folder is also present.  This runs the Flow   This works perfectly.

    When I copied the command line 'SendPrintableForm.Run(SelectedFirstName_Lbl.Text & SelectedLastName_Lbl.Text,HtmlText2.HtmlText)'
    that sends the metadata , picture, signature and Email to the  Button for New Visitor, but does not produce the image linked to the metadata for the visitor.

    SelectedFirstName_Lbl.Text & SelectedLastName_Lbl.Text provide details of who the badge is for.

    Below is HTML I'm using for the Search screen.
    <td style='width:100px;'><img src="&ThisItem.'Link to item'&" style='width:100px;height:100px;'>
    </td>
    </tr>
    <tr>
    <td style='width:100px;'><strong>Name</strong></td>
    <td>"&ThisItem.FirstName& " " &ThisItem.LastName &"</td>
    </tr>
    <tr>
    <tr>
    <td style='width:100px;'><strong>Job Title</strong></td>
    <td>"&ThisItem.JobTitle.Value &"</td>
    </tr>
    <tr>
    <td style='width:100px;'><strong>Issue Date</strong></td>
    <td>"&ThisItem.IssueDate &"</td>
    </tr>
    <tr>
    <td style='width:100px;'><strong>Expired Date</strong></td>
    <td>"&ThisItem.ExpiredDate &"</td>
    </tr>
    <tr>
    <td style='width:100px;'><strong>Badge Number</strong></td>
    <td>"&ThisItem.ID &"</td>
    </tr>
    </tbody>"

    This is the HTML I'm using for the a New Visitor

    <td style='width:100px;'><img src="&Image1.Image &" style='width:100px;height:100px;'>
    </td>
    <tr>
    <td style='width:100px;'><strong>Name</strong></td>
    <td>"&IDFirstName.Text& " " &IDLastName.Text &"</td>
    </tr>
    <tr>
    <td style='width:100px;'><strong>Job Title</strong></td>
    <td>"&IDJobTitle.SearchText &"</td>
    </tr>
    <tr>
    <td style='width:100px;'><strong>Expired Date</strong></td>
    <td>"&IDExpiredDate &"</td>
    </tr>
    <tr>
    <td style='width:100px;'><strong>Badge Number</strong></td>
    <td>"&IDBadgeNumber.Text &"</td>
    </tr>
    </tbody>"

    The image and the Job Title fields are not displaying.

    ------------------------------
    Chris Clark
    Test Analyst
    ------------------------------



  • 11.  RE: Can two Flows be associated with one button

    Bronze Contributor
    Posted 5 days ago
    Chris,

    If the first action on that button creates the "Visitor" entry (via SubmitForm or Patch), you could use LastSubmit to get some of those values (e.g.: LastSubmit(VisitorsList).LastName would be the LastName field most recently submitted to the VisitorsList data connection).

    For that HtmlText, it's a bit of a hack, but what I would do (and have done, in a few cases) is add a custom data card to the form with an HtmlText control to contain that information. However, a cleaner solution is to simply have Flow build it. In other words, just pass the ID of the list item to Flow, then use a "SharePoint > Get item" (<- Note 'item' is singular!) action to get the details for the given item ID, then build the HTML using a Compose action (or HTML Table, if you want to make it into a table). I've learned to minimize the number of parameters that get passed to a Flow...it just makes things a lot simpler in the end. Typically, just sending the ID of the item is sufficient.

    ------------------------------
    Chad Kealey
    ------------------------------



  • 12.  RE: Can two Flows be associated with one button

    Silver Contributor
    Posted 5 days ago
    Hi Chad,

    I think I may have over complicated thinks but it was the only way I could think of to enable the metadata along with the Image to be uploaded to my SharePoint list and trolling through videos was to create a Flow to send the metadata and image from the initial Visitor screen, where new data is entered along with the captured image.

    Due to GDPR we can not keep any data / image until the visitor as consented which is the last action of the process.

    So the 'Upload' button OnSelect formula contains two Flow's - SPUploadImageData uploads the metadata and image to my SharePoint list. The SendPrintableForm Flow is the one I copied from the Search screen which when selected in that screen creates the badge.

    Set(
    Returnpic,
    SPUploadImageData.Run(
    IDCapturedURL.Text & ".jpg",
    Image1.Image,
    IDFirstName.Text,
    IDLastName.Text,
    IDDropdown_Dept.SelectedText.Value,
    IDDropdown_Loc.SelectedText.Value,
    IDRequestType.Selected.Value,
    IDJobTitle.Selected.Value,
    VisitorEmail.Text,
    IDCapturedURL.Text,
    Visitorphonenumber.Text,
    IDExpiredDate.Text,
    IDIssueDate.Text,
    IDChecked_Dropdown.SelectedText.Value,
    TypeofID_Dropdown.SelectedText.Value
    )
    );
    SendPrintableForm.Run(SelectedFirstName_Lbl.Text & SelectedLastName_Lbl.Text,HtmlText2_1.HtmlText)

    form2

    ------------------------------
    Chris Clark
    Test Analyst
    ------------------------------



  • 13.  RE: Can two Flows be associated with one button

    Bronze Contributor
    Posted 5 days ago

    Chris,

    Based on this statement:

    "Due to GDPR we can not keep any data / image until the visitor as consented which is the last action of the process."

    I don't think there is a practical way to do this in one button click. When you say "last action of the process", I assume you mean in Flow (using an Approval or some other mechanism).

    I'll be honest and say that I have not even attempted to send an image with metadata from PowerApps to SharePoint, using Flow or otherwise, so that whole formula seems foreign to me. I'm sure it makes sense to someone who's done this (or something like it) before. 



    ------------------------------
    Chad Kealey
    ------------------------------



  • 14.  RE: Can two Flows be associated with one button

    Silver Contributor
    Posted 2 days ago
    Hi Chad,

    I'm approaching this from another angle.

    I've tried the copying of the html and Flow formula and placing it in the screen where I require the visitor badge to be printed when a new visitor is recorded on the system.

    But for some reason the code within the html 'ThisItem' does not work.

    The code with prefix ID is valid but the only think that doesn't print is the Image.

    Image1 relates to the a field from the initial screen which captures the Photo Image of the visitor.

    Would you know how to display the image, associated with the new visitor , to be displayed?

    "
    </td>
    </tr>
    <td style='width:100px;'><img src=<td style='width:100px;'><img src='"&Image1&"' style='width:100px;height:100px;'>
    </td>
    <tr>
    <td style='width:100px;'><strong>Name</strong></td>
    <td>"&IDFirstName& " " &IDLastName &"</td>
    </tr>
    <tr>
    <td style='width:100px;'><strong>Expired Date</strong></td>
    <td>"&IDExpiredDate &"</td>
    </tr>
    <tr>
    <td style='width:100px;'><strong>Badge Number</strong></td>
    <td>"&IDBadgeNumber.Text &"</td>
    </tr>
    </tbody>"

    ------------------------------
    Chris Clark
    Test Analyst
    ------------------------------