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