AnsweredAssumed Answered

Recalculate or validate calculated control on form submit?

Question asked by scalawagd on Jul 13, 2016
Latest reply on Jul 20, 2016 by scalawagd

Hi, I have run into a scenario with a form that I am struggling with.  I created a signup form for a client that allows people to sign up for a volunteer shift.  There are a certain number of openings for any given shift.  I have a related list that contains all of the available shifts and the number of openings.  When a request is submitted, a workflow subtracts one available shift from the related list of openings.  On the request form, you choose a shift, and a calculated control does a lookup to the related list and displays the number of openings. 

The calculated control formula is as follows:

lookup("Shift Openings", "ID", Shift , "Openings")

 

If the number of shifts is less than 1, a formatting rule displays the number of openings bold and in red, and then a validation rule will prevent the person from submitting it.

 

nintexformvalidation1.jpg

 

This was working perfectly well and I didn't see the gap in the logic until we ran into a scenario today...

Two people were filling out a request for the exact same shift at the same time.  The calculated control on the form looked at the related list and displayed 1 opening.  Person A, then submitted their form and the workflow subtracted 1 opening.  Person B had selected the shift prior to Person A's workflow subtracting 1 opening, so Person B's form was also showing 1 opening in the calculated control.  Both were submitted and the result was the shift was overbooked and now has -1 available. 

 

I know I can add a condition in the workflow to check, but I'd prefer to give instant feedback to the submitter and allow them to select another shift with out having to submit a new form.  So, this brings me to my question... Is there a way I can force that calculated control to recalculate when the Save/Submit button is clicked, or can I have that button click do some kind of lookup validation and prevent it from being submitted if the number of shifts becomes 0 before the person submits it?  Other approaches are welcome too.  I'd prefer to do it without JavaScript if possible, since I am not very strong in that area.

 

Thank you very much!

Brian

Outcomes