AnsweredAssumed Answered

Extending default copy action around flex relate field

Question asked by Neil Conacher on Aug 28, 2019
Latest reply on Sep 5, 2019 by Neil Conacher

When you use the record Copy action, there are a number of ways you can prevent certain fields copying.

 

https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_9.0/Cookbook/Customizing_Prefill_Fields… 

 

I have used the 'simple' method successfully around basic fields contained in a copyprefill.php file under a module

 

eg. 

$dictionary['Bug']['fields']['description']['duplicate_on_record_copy'] = 'no';

However, I would like to override the default behaviour on a flex relate field so the user is forced to choose the parent module and record.

 

For example, in Tasks module (which can relate to many modules as defined in the parent_type_display dropdown list), I disabled the parent_name field copy using the method outlined above.

 

$dictionary['Task']['fields']['parent_name']['duplicate_on_record_copy'] = 'no';

 

Behaviour changed to default to 'itself'. For example, I copy a Task which is related to an Account and is named 'Speak to CEO', this copies as being related to a Task and carried forward the copied name 'Speak to CEO'

 

The behaviour I would like would be a blank parent type (this might involve adding blank to the parent_type_display dropdown list ?) and also not filling out the parent name, so the user is required to fill in the parent type and related record.

 

Any guidance welcome.

 

Thanks

 

Neil

Outcomes