Required relate field

Fairly new to SuiteCRM, sitll muddling my way through some things with this excellent product.
I am attempting to make some relate fields compulsary using PHP using instructions as found HERE however this is not working, I suspect because I am not 100% sure what name I should be using for the field I want to be compulsary :blink: and am accordingly getting it wrong. Your brainpower would be much appreciated.

Hi, welcome.

You can try checking the original vardefs of the module you’re trying to use.

That “require” field is merely an alteration to existing vardefs, so if you check the originals you can make sure you’re changing a field name that exists.

Example:
modules/Contacts/vardefs.php

Thank you for the reply. Still haven’t got it working.
When setting up the database, I renamed the original module for clarity, so instead of Accounts it is called Parishes or Organisations. The vardefs in accounts’ directory do not seem to apply (unless I’m getting something else wrong, haven’t got anything to cooperate thus far) So where I’m at now is a file in /custom/Extension/modules/Documents/Ext/Vardefs/documents_accounts.php which reads:

<?php
$dictionary['Documents']['fields']['accounts']['required'] = true;

and doesn’t make the related field compulsary. Further wisdom of the web would be much appreciated.

Why don’t you use Studio?

Give it a try.

I wish it were that simple, but relationship fields aren’t available to edit in Studio. It would have been so much easier if I could simply open it and tick a box.

Oh, I see!

Take a look at this plug in: Conditional Notifications. It saved so much time!!

https://store.suitecrm.com/addons/conditional-notifications

Create a conditional notification on the module and assign it as prevent record saving.

For USD 194 one shot, it’s a bargain! Start a free trial and you have your problem solved in 5 minutes!

Cheers,

Thanks for that, good idea. I’ll definitely keep that in mind as an option.
That said, if I can, I’d like to avoid the budget request and permission process that would be required to get a product like that implemented and figure out how to get this working using code, I’d have though it should have been fairly simple (though the head shaped dents in my desk do tend to suggest otherwise). If there’s any brains out there who can help me do that, I’d be greatly appreciative.

I assume you remembered to do a Quick Repair and Rebuild? Did you scroll down to the bottom to see if there was a button there to “sync database with vardefs”?

Can you check if your entry was recognized and appears in

custom/modules/Documents/Ext/Vardefs ?

Thank you!
I can confirm that I did the repair and rebuild (though I did it again to make sure) and yes, it did sync the vardefs.
Your suggestion led me to the answer. In custom/modules/Documents/Ext/Vardefs I found a reference to the actual field name that needed to be compulsary (accounts_documents_name_1) which solved my issue. Your help in navigating the labyrinthine innards of SuiteCRM has been invaluable.

Has anyone stumble upon that adding required tag works on local computer but not on test server?
I am having that right now, and don’t know how to solve it?