0
  • I'm using Calendar view. I want to limit the number of entries to 50 per day and no more.
  • I want to remove Saturday and Sunday from the calendar.
  • I want to be able to cap off (not allow) the last 5 business day of each month.

I'm familiar with workflows and calculated columns. Does this sound like something that can be done?

Thanks in advance.

1 Answer 1

0

It does.

  • I'm using Calendar view. I want to limit the number of entries to 50 per day and no more.
  • I want to remove Saturday and Sunday from the calendar.
  • I want to be able to cap off (not allow) the last 5 business day of each month.

Usability-wise, though, I would not recommend using workflows to do the 50-items-per-day check. In the worst case a user spends time to create the item, then sees it popping up in the calendar and then it's suddenly gone and you get a complaint and the user is annoyed.

Instead, I would do those checks on the client. In order to keep track how many items have been created, you can use a Workflow and a helper-list. Every time a calendar event is created, a workflow is triggered and increases a counter (numeric field of a simple item in the helper-list). The Workflow also checks the Modified-date of that list item in the helper-list. If the Modified-date is not Today then the counter is set to 1.

On the client you make a simple REST-call to receive the counter-item value from the helper-list and if it's 50 or above, you present the user with an Alert saying that no further events can be added. You can do that in the PreSaveAction() or even earlier via an EventListener so that the user gets immediately notified that no further events can be added.

Removing Saturday and Sunday will be very tricky. The calendar event boxes are rendered on top of the calendar grid and are absolute-positioned. Removing columns from the month or week view will lead to wrongly aligned event-boxes. But you can try to deactivate the cell's events so that the "Add"-button does not appear anymore when you hover over it. You will also have to stop the Click-event from propagating so that it won't trigger the opening of the NewItem-form.

On the form itself you can implement another check in the PreSaveAction() that checks what weekday has been selected and prevents adding the event if necessary.

The same applies for the last 5 business days of each month.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.