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?
Solved! Go to Solution.
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)
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.
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.
@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,
Duration: 120000 (2 minutes)
OnTimerEnd: Set(DisableButton,true)
Start: varFlowStart
AutoStart: false
Repeat: 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.
@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.
not yet, wanted to be sure that this will work for my case... will test it tomorrow, thanks again
User | Count |
---|---|
258 | |
108 | |
93 | |
57 | |
40 |