cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
djreyes1110
Helper V
Helper V

undefinedOnSuccess with 2 Success Screen base from choices

Hello, 

I am using SharePoint List as my datasource and I have a column named Status with 2 selection, returned and borrowed. 

 

If the user selected Borrowed it should navigate to SuccessScreen and if its returned navigate to SuccessScreen1. 

 

I tried this formula below and both is routing to SuccessScreen1. 


If(
DataCardValue2.Selected.Value = "Borrowed",
Navigate(SuccessScreen),
DataCardValue1.Selected.Value = "Returned",
Navigate(SuccessScreen1)
)

 

Also tried this but I am getting an error which I know my function is incorrect.

 

Set(
formtype,
"Edit";
Set(
selectedItem,
DataCardValue2.Selected.Value = "Borrowed"
)
);
Navigate(SuccessScreen);
Set(
"Detail",
DetailScreen1;
Set(
selectedItem,
DataCardValue1.Selected.Value = "Returned"
);
Navigate(SuccessScreen1)

 

Thank you so much for your help!

20 REPLIES 20

Thank you so much. Sorry just a first timer in using the if function. 

 

If('Asset Sign Out'.Status = "Borrowed", Navigate(SuccessScreen); 'Asset Sign Out'.Status. = "Returned", Navigate(SuccessScreen1))

 

Not sure how to fix this, or I might just use one success screen. Is there a way to fix the function above?

Thank you again!

So I'm assuming you have a Gallery Screen where you Select a record, a Detail screen where you can view the record, and an Edit Screen where you can Edit the record.  If that's the case then the If statement should only be in the onSuccess for the Edit Screen.  The Detail Screen doesn't do anything so there is no Success or Failure.  So it should all be based on the Dropdown on the Edit screen.

If(
DataCardValue2.Selected.Value = "Borrowed",
Navigate(SuccessScreen,ScreenTransition.Fade),
if(DataCardValue2.Selected.Value = "Returned",
Navigate(SuccessScreen1,ScreenTransition.Fade))
)

Where DataCardValue2 is the dropdown on the card in the Edit form where you put this in the OnSuccess code.  That works in my proof of concept.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Im using SharePoint list and its just one form. I have a column in my list which is Status with Return and Borrow choices. Its the same dropwdown. Just would like to user to navigate to different success screen. 

 

 

Then this code should work unless something else is manually navigating somewhere.  Is there a Navigation in the Check icon?

If(
DataCardValue2.Selected.Value = "Borrowed",
Navigate(SuccessScreen,ScreenTransition.Fade),
if(DataCardValue2.Selected.Value = "Returned",
Navigate(SuccessScreen1,ScreenTransition.Fade))
)

 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Hello, 

There is navigation in the check Icon, the function is Submit(EditForm1). I tried the formula and when I select borrow it navigates to SuccessScreen1.

 

Thank you so much for helping.

Hi, sorry I missed this. You are correct I have a detail screen to view records and an edit screen. I am using OnSuccess for Edit Screen.  I used the function you provided, when I select borrow from my dropdown and hit submit I am still navigated to SuccessScreen1 and it should ne to SuccessScreen.

The problem is that the Check icon code runs before the OnSuccess code.  You say there is navigation, but SubmitForm() won't navigate somewhere on its own.  But if there is navigation on the Check icon that is where it will go no matter what you put in the OnSuccess.  Other than that I've tested the code I supplied with a form and it works for me.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Then something else is causing the navigation to SuccessScreen1 before the OnSuccess runs.  I've tested that code using an Edit form and it does work if something else doesn't do the navigation first.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Ive used the below function in the check icon SubmitForm(EditForm1);If(DataCardValue2.Selected.Value="Borrowed",Navigate(SuccessScreen,ScreenTransition.Fade),If(DataCardValue2.Selected.Value="Returned",Navigate(SuccessScreen1,ScreenTransition.Fade)))

 

and removed it from the OnSuccess and set it up to false bu still not working. I am not sure what I am doing wrong.

Thank you so much for your patience. 

 

 

 

Make sure that the SubmitForm isn't clearing the values in the dropdowns and resetting them to the default before you get to the navigate.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,330)