cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
wessels
Regular Visitor

navigate to next screen based on time or flow result

Hi

I have created a flow with variables that need to do a bespoke approval flow. If the flow fails or succeeds it returns a result to say success or failed. 

wessels_0-1656961061993.png

The problem is because it is a approval flow - the wait time could be days. The main reason I have a response is to basically pick up if there were an error and the approval flow cancelled / errored out and was never created.

 

I have a timer on my app screen that is hidden. I start the timer when the user presses the button. I would like the navigation to the success screen to happen after 6 seconds and not wait for a response back - because by that time I know the approval flow has gone through without errors and navigate to Failed screen when response comes back within 6 seconds that approval has failed. 

 

This is my code:

 

 

Set(tStart,true);
If(HCCApproveDocuments.Run(ddApproval.Selected.Value, Text(tbRequester.Text,Email), Coalesce(Text(cbApprover.Selected.Mail, Email),"noemail.yahoo.co.uk"),lFileName.Text,lURL.Text,{email_2:Text(Coalesce((cbEndorser.Selected.Mail),"noemail@yahoo.co.uk"),Email),email_3:Text(cbReviewer.Selected.Mail,Email),text_3:tbComments.Text}).response="Success" Or TimerSuccess.Duration > 6000,Navigate(Success),Navigate(Failed)) ;

 

 

The problem is that it ignores the timer and wait for a response before it navigates and obviously this won't work as an approval can take days before someone press approve or reject.

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Alex_10
Super User
Super User

@wessels 

 

can you try this:

 

Set(varFlowResponse, "-");
Set(tStart,false); Set(tStart,true);
Set(varFlowResponse,
    HCCApproveDocuments.Run(ddApproval.Selected.Value, 
        Text(tbRequester.Text,Email), 
        Coalesce(Text(cbApprover.Selected.Mail, Email),"noemail.yahoo.co.uk"),
        lFileName.Text,
        lURL.Text,
        {
            email_2: Text(Coalesce((cbEndorser.Selected.Mail),"noemail@yahoo.co.uk"),Email),
            email_3: Text(cbReviewer.Selected.Mail,Email),text_3:tbComments.Text
        }
    ).response
);


TimerSuccess.OnTimerEnd = 
Set(tStart, false);
If(
    varFlowResponse = "-",    Navigate(Success),
    varFlowResponse = "Success",    Navigate(Success),
    varFlowResponse = "Failed",    Navigate(Failed)
);


TimerSuccess.Duration = 6000
TimerSuccess.Start = tStart

 

View solution in original post

1 REPLY 1
Alex_10
Super User
Super User

@wessels 

 

can you try this:

 

Set(varFlowResponse, "-");
Set(tStart,false); Set(tStart,true);
Set(varFlowResponse,
    HCCApproveDocuments.Run(ddApproval.Selected.Value, 
        Text(tbRequester.Text,Email), 
        Coalesce(Text(cbApprover.Selected.Mail, Email),"noemail.yahoo.co.uk"),
        lFileName.Text,
        lURL.Text,
        {
            email_2: Text(Coalesce((cbEndorser.Selected.Mail),"noemail@yahoo.co.uk"),Email),
            email_3: Text(cbReviewer.Selected.Mail,Email),text_3:tbComments.Text
        }
    ).response
);


TimerSuccess.OnTimerEnd = 
Set(tStart, false);
If(
    varFlowResponse = "-",    Navigate(Success),
    varFlowResponse = "Success",    Navigate(Success),
    varFlowResponse = "Failed",    Navigate(Failed)
);


TimerSuccess.Duration = 6000
TimerSuccess.Start = tStart

 

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (4,006)