Simultaneously Update same field in multiple modules within an account.

In SuiteCRM 7.2 - is there a way to create the same field in multiple modules in one account so that the data change in one field will update the same field in another module within that account? For example, if I had a field at the account level and the same field at the opportunity level (or contact level) can the fields be associated so that if the content of one field is updated or changed, the related field is also updated or changed?

Hi Ritchie.
I can imagine multiple ways of achieving that, but all of them will require that you go through PHP code, which is fairly simple in this case.
If you had standard fields and the only thing you wanted was to show a field (not edit it) from one module in another module, you could try using “related” fields, please see these links for reference:
http://forums.sugarcrm.com/f6/add-grandparent-field-module-views-ce-6-5-2-a-82177/#post286075
http://forums.sugarcrm.com/f148/want-include-two-fields-another-module-80729/#post280917
http://forums.sugarcrm.com/f3/adding-related-fields-listview-85445/
https://johndopenotes.wordpress.com/2013/03/18/sugarcrm-populating-fields-using-a-relate-field/

The following is a non-upgrade safe manner, which it’s NOT recommended:
http://developer.sugarcrm.com/2011/04/26/howto-add-a-field-from-a-related-module-into-the-listview/

And finally, since the first technique does not work for custom fields (which I believe it’s your case), maybe you should try Logic Hooks. Logic Hooks allows you to define functions that will be called whenever SuiteCRM retrieves a record from the database, before or after saving a record to a database, when listing records in a ListView, and some other situations.

In the following link I propose a solution to overcome the “related field” limitation of working only for standard fields, using LogicHooks. Please have a look at it:
http://developer.sugarcrm.com/2012/03/13/howto-grab-fields-from-a-related-record-without-sugar-logic/comment-page-1/#comment-31637

On the other hand, if you want to edit the field in one module and have it updated in another module, you’ll always be able to do that using LogicHooks. So, for every module you would need to write a LogicHook function for the “before_save” event, where you’d need to retrieve the related records in other modules and update the corresponding fields there. Or you can do the opposite: whenever you retrieve a record from the database (after_retrieve event in LogicHooks) you can populate your desired fields using data from related records in other modules. In my case I already do that for one specific case.

Please, have a look at the links provided above and get to me if you need further assistance.

Cheers, Celso.

You may also consider using Workflow, which will not require any programming.

1 Like