cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

Preventing Double-booking with Validation

Jump to solution

I'm trying to create a Nintex form in Sharepoint 2013 that helps prohibit double-booking in a Calendar List. To do this I've created a relatively simple formula, using a rule of type "Validation". The formula is 

not(isNullOrEmpty(lookup("ARB Calendar","EventDate",StartTime,"ID")))

When using trying to submit the form I get an on-screen error message that states "Validation Error - There was an issue validating the data entered on the form; please try again. If the problem persists, contact the form owner.". In the browser's debugger I see "Handling all asynchronous validation rules failed". I've been able to validate that the proper data comes back from the server using Fiddler to inspect my web traffic and seeing the JSON response that contains the event that otherwise fulfills the lookup query.

For an interesting twist, I used the same formula for a "Formatting" rule, and that fires just fine turning the label red to help indicate the problem. 

Is there a better way of preventing double-booking of an event in a Nintex form, or perhaps something I'm not doing right here?

Labels: (1)
Reply
11 Replies
Workflow Hero

Re: Preventing Double-booking with Validation

Jump to solution

have a look on this post How to connect Forms with JS Function returning an argument 

Is there a better way of preventing double-booking of an event in a Nintex form

in sharepoint you can never reliably avoid double booking (resp. parallel entry of the same information) until you configure a field to 'Enforce unique values'

0 Kudos
Reply
Workflow Hero

Re: Preventing Double-booking with Validation

Jump to solution

Thank you Marian, I did look at the post and modified my lookup to try the "length" function, but I get the same results where the validation rule is causing an error to be returned behind the scenes.

not(equals(length(lookup("ARB Calendar","EventDate","EventDate","ID")),0))

or

not(equals(length(lookup("ARB Calendar","EventDate",StartTime,"ID")),0))

There seems to be something happening either deeper in the JS or on the server that is causing this problem. Is there somewhere I should be looking beyond the Console window in Chrome or IE for additional information?

0 Kudos
Reply
Workflow Hero

Re: Preventing Double-booking with Validation

Jump to solution

I think I've found a very very janky workaround. Given that calculated fields are pulling back information appropriately, I've moved my logic there, such that it evaluates to "true" or "false". Then in my validation rule I'm checking the calculated control for equivalence to "true" to trigger the validation. This seems to be working so far, though I'd love to solve the core problem rather than use this hack.

0 Kudos
Reply
Workflow Hero

Re: Preventing Double-booking with Validation

Jump to solution

you miss there one additional parameter in lookup() function call.

try following

not(equals(length(lookup("ARB Calendar","EventDate","EventDate","ID",true)),0))

‌ check item exists‌ double booking‌ double entry‌

Reply
Workflow Hero

Re: Preventing Double-booking with Validation

Jump to solution

This only works for checking that exact date/time, not whether or not the StartDate falls within another events Start/End time.  Did you come up with a solution for that scenario?  Thank you!

0 Kudos
Reply
Workflow Hero

Re: Preventing Double-booking with Validation

Jump to solution

this is not possible with lookup() function.

it only can make comparison for equality.

0 Kudos
Reply
Workflow Hero

Re: Preventing Double-booking with Validation

Jump to solution

Thanks for the information Marian!  Do you know of a way to achieve a true double book check?  I see that the lookup can return back an array of items, is there anyway to leverage that data?

0 Kudos
Reply
Workflow Hero

Re: Preventing Double-booking with Validation

Jump to solution

Do you know of a way to achieve a true double book check?

sure, I know.

do not use sharepoint

to be serious, note my above statement

in sharepoint you can never reliably avoid double booking (resp. parallel entry of the same information) until you configure a field to 'Enforce unique values'

you can hardly avoid double booking from client side. definitely not with sharepoint.

it has to be ensured on server/data store side. sharepoint provides an option 'enforce unique values' for a single list field.

if that's not sufficient for you, you are out of luck.

I see that the lookup can return back an array of items, is there anyway to leverage that data?

yes, lookup() function can return array of values. but still just for equality condition (eg. StartTime == <Todat at noon>)

for complex conditions like MyTime falls within date/Time range you would either would need to script it out or check afterwards with workflow.

0 Kudos
Reply
Workflow Hero

Re: Preventing Double-booking with Validation

Jump to solution

do not use sharepoint

haha!  I'm beginning to figure that out.  We are currently using the old 2010 group work site feature but I would like to find a solution that can migrate/scale with SP as we upgrade from 2013 and beyond.  Any recommendations?  I was hoping to achieve with Nintex but not looking like I can.

 

it has to be ensured on server/data store side. sharepoint provides an option 'enforce unique values' for a single list field.

I've seen that column on the list but am unsure of its purpose.  Do you know?

We do have Nintex Workflow as well to check after the fact, but the ability to see before an event is created is very much desired by the client.

0 Kudos
Reply