cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sifu
Post Prodigy
Post Prodigy

Restrict "pace" of user submitting the form

hi guys, 

i have a sharepoint form where user can request home office or holiday. Once he submits a flow starts which deducts the requested days of holiday from his "vacation days" and asks the manager for approval, if he approves all good, if rejects, days are set back...

the problem i see is that if he makes two quick requests after each other... the flow wont be able to deduct the vacation days and will therefore submit to manager the current days 2x... for example:

I have 20days of vacation available. I ask first for 20, and quickliy after again 20. Manager does not realize and approves. The flow will update the current vacation status with 0 (but will not restrict me for my second request....)

If i would wait 1 minute, between the requests, the powerapp form would tell me that i dont have the days available....

Any ideas whats the best solution?

22 REPLIES 22

@eka24 hey, tested the first version, i put  the variable on start:

Sifu_0-1592981852912.png

i added the values to the submit button (maybe here i am not sure what you mean with flow button, i hope its same thing...)

Sifu_1-1592981917752.png

but the result is, i think expected, i guess i do something wrong (its disabled all the time)

Sifu_2-1592981953759.png

 

 

eka24
Community Champion
Community Champion

The OnStart formula should be false;

Set(DisabledButton,false)

 

Then OnSelect of the Submit button:

Set(DisabledButton,true)

 

The rest of What you have done is ok.

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

@eka24 i tested the time related workaround...

i could not figure what you meant with the runflow.... on the submit button.

  RunFlow();Set(varFlowStart,true)

 

the only way how to run this thing was like

Set(varFlowStart,true); SubmitForm(SharePointForm1)

this however means that the timer is reseted every time I refresh the page (and it actually does not start since the submit form will move us to a different screen, so not sure 😞 )

eka24
Community Champion
Community Champion

The Run Flow is just an example. So it should rather be;

SubmitForm(SharePointForm1);

Set(varFlowStart,true)

 

I don't understand the moving to the other screen bit. If the form has not finished submitting, it should not move to other screen. 

 

I don't know the formula you used in moving to other screen after submitting, but it should be Onsuccess of the form. So that it will only move to next screen after successful submission.

 

I hope you are ok with the first option?

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

@eka24 I managed to do the first option with disabling the button after submitting, works but the problem remains. If the user refreshes the page the button is active again. The same problem will be with the timer.

I think i would require some solution that would look into the list of submited requests for holiday, so following conditions:

- its a holiday

- its from the user that is logged in

- it was submitted 1minute or less ago

In these 3 cases, it should do something.... like display a message or anything.. if i work out how to filter that i work out also the rest. So far the biggest problem 

eka24
Community Champion
Community Champion

Well you can try those options as well. But i dont see how setting a variable Onstart will be reversed just by refreshing a page. That cannot happen. it can only reset after restart of the app and not refresh. But can try the option you stated as well, you know what can best suit you situation.

 

Edited

What about looking at the Approval process? If a request more than once, the approval process should not go through if the criteria is not met. In this way no matter how many times the person request, although the balance might be misleading due to non approval on time, there will not be any issue.

 

Also you can have another column (may be a collection) that gives a provisional balance as against the Approved Balance. This way, the users is aware that some of the requested leaves have not been approved.

 

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

@eka24 yes i was thinking also in this direction of another column and compare it durring approval but does not seem to be good logic...  I have now created following formula

 

Filter('time restricted submission', Title = "a", 'Created By'.DisplayName=Office365Users.MyProfile().DisplayName).Created

- this gives me the date and time of the items whre column title = a, and the created by is user who is using it... now i need to add "last":

Last(Filter('time restricted submission', Title = "a", 'Created By'.DisplayName=Office365Users.MyProfile().DisplayName).Created)

- but this breaks the date format, any idea how to fix that?

eka24
Community Champion
Community Champion

I don't understand break the Date. Also what happens when you request more than twice a day 

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

this should be used as filter where, when the user opens the page/application... the system will check when he submitted his last request (gets the date), now compares it to current date and time and if its more then 2min, it gives user the option...

i think i got it:

first check the column for "A" (holiday) where created by is matching the user operating the form

dropdown: Last(Filter('time restricted submission', Title = "a",'Created By'.DisplayName=Office365Users.MyProfile().DisplayName).ID)

the created date for the ID above:

Label: LookUp('time restricted submission',ID=Dropdown1_4.Selected.ID, Created)

compare the time of created above to now

Label: DateDiff(LookUp('time restricted submission',ID=Dropdown1_4.Selected.ID, Created),Now(),Seconds)

 

test object to show or hide:

If(Value(Label9_1.Text)>50,true,false)

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.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

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 (2,078)