how to make "assigned to" a required field.

How can I make the “assigned to” field a required field, so it can’t be empty?

Maybe you can check the field using a logic hook and see if the field is empty? Will that work?

That would work as a last resort. But I’m looking for a functionality that works like all other required fields, i.e. user can’t save unless field is not empty.

I don’t really have time to check now, but isn’t there something in the vardefs where you say a field has required=true or something?

1 Like

pgr yes that’s it. forgot about that. Thanks.

Added file to /custom/Extension/modules/[MODULENAME]/Ext/Vardefs/

with

<?php 

$dictionary['[MODULENAME]']['fields']['assigned_user_name']['required']=true;

?>

after quick rebuild it’s now a required field.

1 Like

Apologies for the rez.

We’re trying to make Assigned User a required field in Opportunities and we’ve had no luck with the solution here.

We’ve tried the snippets below - has anyone managed this?

<?php $dictionary['opportunity']['fields']['assigned_user_name']['required']=true; ?>

Saved in /custom/modules/Opportunities/Ext/Vardefs/assigned_user_name.php

and

<?php $dictionary['opportunity']['fields']['assigned_user_id']['required']=true; ?>

Saved in /custom/modules/Opportunities/Ext/Vardefs/assigned_user_id.php

7.11.5 on CentOS 6

It’s

$dictionary[‘Opportunity’]

with a capital O, not a lower case o

Hi pgr,

I’ve made the changes to capitalise the O but still no change :confused:

Could this be a relationship to Users issue?

Now on 7.11.18 CentOS 7

Sorry, if that’s not it, I don’t know what the problem could be. Setting a breakpoint in the code will let you examine the entire currently loaded dictionary, which is usually the best way to make sure you’re using the correct module and field names.

Set the breakpoint in the file that is generated by the Quick Repair and Rebuild, that is, look for it under custom/Extension/modules

Hi,

The easiest would be to add

            'displayParams' => 
            array (
              'required' => true,
            ),

to assigned_user_name in editviewdefs.php

1 Like

Hi blqt<

Thanks for the suggestio. I’ve tried as you said + repair/rebuild - still no change unfortunately.

I trust I’ve entered it correctly?

What you did is not correct.
It should be

          array (
            'name' => 'assigned_user_name',
            'label' => 'LBL_ASSIGNED_TO_NAME',
            'displayParams' => 
            array (
              'required' => true,
            ),
          ),
1 Like

Thanks for the tip

I’ve updated the code but still no dice :confused:

You need to do that in another array like you have for name and currency_id

         array (
          array (
            'name' => 'assigned_user_name',
            'label' => 'LBL_ASSIGNED_TO_NAME',
            'displayParams' => 
            array (
              'required' => true,
            ),
          ),
        ),

Then, Repair/Quick Repair

1 Like

Hi again,

Thanks for your suggestions.

I’ve resolved the issue using mikebeck’s answer in this fairly old thread Field assignment

I realise I made the earlier mistake of not going custom/Extension - instead I went down custom/modules…

Apologies for the ineptitude/inability to read :roll_eyes:

1 Like