How do I create a date restriction on new opportunities for a same client?

I need to create a restriction in the Opportunities module where no one is allowed to create a new opportunity for a client unless it has been 6 months or more since the last opportunity’s close date.

I’ve looked everywhere for the past 2 weeks but can seem to find and answer and I’m going nuts trying to figure this out by myself. Do I actually have to code or is this something that needs to be done using Workflow module?

welcome to the suite-community!

I don’t believe it is doable with workflows, at least I can’t come up with an idea how to do it.

What comes to mind is something like a before_save-hook, that does something like

SugarApplication::appendErrorMessage('there is already an active opportunity for this client!');

you could additionally hide the “create” button as well, e.g. using JS: