SugarCRM installable changes in detailview

I have a simple problem, but it can be serious for me, I created custom fields and added them all to the custom\modules\Leads\metadata\detailviewdefs.php (detailview) layout of the Leads module, but the problem is that I have to make a change package installer. I managed to create custom fields and copy them in the manifest custom\Extension\modules\Leads\Ext\Vardefs . Now I don’t know how to apply detailviewdefs changes through the manifest (add a new field bar to the detailed view). The fact is that the existing detailview layout should not be changed, but only add a new panel to it.

A possible solution in my mind is that I should add the code to the $ layout_defs $layout_defs["Leads"]["DetailView"] ['panels']['panel_name'] and put it in custom\Extension\modules\Leads\Ext\Layoutdefs\ and copy the Layoutdefs file through the manifest. I tried this but didn't seem to work. If you want, buy a smart solution.

Addition: Even if I export module changes from Studio ->export Customizations and import into another instance using module builder . It overrides all previous user files (settings) in the new instance (this is not a limitation in SugarCRM), but my requirement is to add only changes to the more detailed view of the instance.

+4
source share
2 answers

I found the following ModuleInstaller sugar class functions to add or remove fields from layouts through a manifest script . These functions will add / remove fields at the same time editview and detail view . Just add the following lines to post_install / pre_install , no need to require anything,

  $installer_func = new ModuleInstaller(); $layoutAdditions = array('Users' => 'users_access'); 

To add the users_access field to the Users module:

  $installer_func->addFieldsToLayout($layoutAdditions); 

To remove the users_access field from the Users module:

  $installer_func->removeFieldsFromLayout($layoutAdditions); 

Hope this helps.

Mansoor

+1
source

That's cool. There are two options that I know of. 1) Provide the user with instructions on how to add fields to layouts using Studio 2) In a post_install.php script, simulate how Studio layout deployment works to insert your fields into any layout (best practice would be to create a new panel for all your fields if mass distribution).

+2
source

Source: https://habr.com/ru/post/1438806/


All Articles