HiI am trying to do a very basic thing but I am stuck and I cant find the answer anywhere.
I have created a form from a list in Sharepoint:
I have added a button that I would like to do the following:
On the Button I have added this is OnSelect:
if(VarCurrentMode,"New",SubmitForm(SharePointForm1);Navigate(ThankYouScreen),ScreenTransition.Fade),SubmitForm(SharePointForm1))
On the SharePointForm1 I have added in OnSuccess:
ResetForm( Self );
If(
varSave,
( SharePointForm1 ),
RequestHide()
)
Any ideas? Very greatful to any good ideas!
Solved! Go to Solution.
@Anonymous
Yes, I had not provided the "next step" on closing the form - that is why you see an empty form.
For your questions...
1. When a mandatory field is not filled in, stay on the screen (or even better, get a notice that something is missing) - This IS part of what a form provides. It has a Valid property to let you know if the form is valid and complete.
2. If it is entered correctly, you should end up on the ThankYouScreen
Actually...you should be saying "if it is submitted correctly"! Yes, this is what the OnSuccess is for.
However, you should consider one thing about SharePoint integration.
The default buttons of Cancel and Save WILL still be there.
If you provide yet another "Submit" button in your app, then this becomes very confusing for users. AND, they can quickly decide to use one over the other.
So, you need to decide up front - will you implement the logic in the OnSave action of the SharePoint Integration, or will you want to avoid it? If you want to avoid it, then the standard method is to provide a notification to the user that they should click on YOUR button in the app and not the Save button if they should click on the standard save button in SharePoint.
Now...back to what you have implemented. If you had the Navigate function in your OnSuccess, then you should have see the Thank You screen when you submitted - not the same form screen and now blank.
But, let me know what your choice is on the above question on the save/submit functionality.
Correcting some Syntactical error in your formula, try as below:
If(VarCurrentMode=FormMode.New,SubmitForm(SharePointForm1);Navigate(ThankYouScreen,ScreenTransition.Fade),SubmitForm(SharePointForm1))
@Anonymous
You never want to navigate immediately after your SubmitForm in your formula!!
There is no guarantee that the form submitted properly and, if you navigate away, the user will never know and your data will be lost.
Instead, change your formula to the following:
SubmitForm(SharePointForm1)
Then, perform any logic in your OnSuccess...including the Navigate function.
I would provide a suggestion on that entire formula, but your provided formula is not accurate, so I will simply say...add your navigate there.
I hope this is helpful for you.
Thank you very much for you answer, but it didnt work unfortunately. I added the formula you provided but now nothing happens instead? Any new idea?
Thanks, and you mean I should put it into SharePointForm1?
This is how it looks, I guess the ThankYouScreen marked red should tell me something....?
Hello @Anonymous:
as per screenshot, issue is with varCurrentmode, How are you setting varCurrentmode variable value?
Please paste code here.
You can try below:
If(VarCurrentMode="New",SubmitForm(SharePointForm1);Navigate(ThankYouScreen,ScreenTransition.Fade),SubmitForm(SharePointForm1))
@Anonymous
Yes, you should have the formula I mentioned in your OnSuccess action formula of your form...if that is SharePointForm1, then that is the place.
You really need NO logic in your Submit action because BOTH the true and the false of your variable condition would result in a SubmitForm...so why even bother?
Simply do the other check you want in the OnSuccess and then navigate as needed.
I see, thanks! Sorry, I am really a newbie so if you have a complete other formula that can do the magic instead 🙂
@Anonymous
Have you tried what I mentioned? If you're a newbie to PowerApps - the one thing you want to start to learn immediately is that you do NOT want to navigate in the Same formula as the SubmitForm.
SubmitForm "starts" at the point that the function is encountered in the formula. BUT, it does not "wait" until it is complete!! It moves on to the next function in the formula.
So, there is NO guarantee that the submit form has completed by the time it gets to your navigate. And, if you navigate prior to the completion, you risk losing data and frustrating users!
THIS is why there is an OnSuccess action (and OnFailure) on the form - to provide you a place to have operations occur when it is a success.