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?

1 ACCEPTED SOLUTION

Accepted Solutions
Sifu
Post Prodigy
Post Prodigy

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)

View solution in original post

22 REPLIES 22
eka24
Super User
Super User

I suggest you disable the Flow button after submitting in the following;

 

Set a Variable OnSelect of the Flowbutton:
  Set(DisableButton,true)


Put the variable either OnStart of the App or on the OnVisible of the Home Page, preferably OnStart such that the user has to restart the App to be able to resend the flow button

 

Then in the DisplayMode of the button put:
  If(DisableButton,DisplayMode.Disabled,DisplayMode.Edit)

 

 With this the button will be disable until Retarrt of App or Until the user goes back to the home page of the variable is kept Onvisible of the home page

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

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.

cds
Impactful Individual
Impactful Individual

Id subtract the requested days from user vacation days. 

 

then if the supervisor rejects the request, just add the days back to user vacation days.

The approach i provided will work for both scenarios. You can put variable on OnVisible of the Home Screen.

Have you tried it or you want further explanation

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

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.

Sifu
Post Prodigy
Post Prodigy

@cds i think that what you describe is what i have currently... but this means that user can submit more then one request because the flow is not really  in speed of light, i am just confused about the "Id subtract"... if this is just short for "I would" or something i dont know?

 

 

@eka24 i think i need more info, from what i understand this would force the user to restart the app/page, that i can do even easier (navigate to a different screen after submitting without restart). but the problem is that the flow can take even a minute or two to do its thing,... and a page refresh is just faster... or am i getting it all wrong?

If you read my suggestion carefully, i suggested 2 options, OnStart and Onvisible.

If you put it onstart you need a restart. If you go by the Onvisible of the screen, you dont need to restart the App. You only need to navigate to another screen and back and that is it.

 

You cannot be sure that the flow will always run for 2minutes. If you are sure it will always run for 2 minutes, I can give another approach, Using a Timer Control

If you are sure of the timing, let me know to give the Timer Approach

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

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.

 

 

If you will go by the Time/ munites approach,

  1. Insert  a Timer Control, Then set these properties:

                 Duration: 120000  (2 minutes)

                 OnTimerEnd: Set(DisableButton,true)

                 Start: varFlowStart

                 AutoStart: false

                 Repeat: false

 

  1.  Set a Variable OnSelect of the Flowbutton:
      RunFlow();Set(varFlowStart,true)

 

  1. Then in the DisplayMode of the Flow button put:
      If(DisableButton,DisplayMode.Disabled,DisplayMode.Edit)

 

  1. If you want to Add another Button to turn the Displaymode to Edit:   Set(varFlowStart,false)

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

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.

Sifu
Post Prodigy
Post Prodigy

@eka24 ok, i have not yet used onstart or onvisible so maybe i dont understand...
but for me it seems that both can be bypassed by restarting the app (refreshing the page)?
Also if you have a timer, you restart the app (refreshing the page) and the thing forgets that a timer was running(?).
Maybe if you missed, this is a customised sharepoint form/list, not an actuall app.

please advice if i am too stupid, still a new guy to powerapps

If you really want to be sure how any of the 3 options will work, you test it in your App. You don't imagine it will not work. Have you tried any of the 3 options?

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

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.

Sifu
Post Prodigy
Post Prodigy

not yet, wanted to be sure that this will work for my case... will test it tomorrow, thanks again

Helpful resources

Announcements
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.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (2,098)