Display related (custom) fields in another module

Hello,
i am new here and my english is not that well so please be patient.
I run suitecrm 7.14.2.

I have added some filed to the account modules. These fields are stored in accounts_cstm table and are used normally. For example “special Description” (specialdesc_c)

Now I wanted to display some of the accountsfields in other custom module (o:o relationship).
I do not need the data there so it must not be database side it should only display the relate informatione in the detailedview to help my users.
I used the way with creating a file in (custom/Extensions/modules//Ext/Vardefs/custom_add.php) and added the needed fields there for testing.


type= relate,
table= accounts,
source=non-db,
readlonly = true,
studio = array(‘detailview’ => ‘true’)

After a quick repair the fileds showed up in my studio and i could use them.
Worked like a charm with all native fields as for example website and billing_address.

But it did not work with my custom fields.
If I try it with a field “specialdesc_c” for example. I do get the field but it stays empty even if data is stored in these field. I guess the vardefs module table did not has a connection to its “_cstm” table

Is there a way to add custom fields to the vardef?
Can anybody help me here?

EDIT:
I found the solution “creating fields via vardefs” (Field Relationships - #6 by jansiero)
But this is not the best way for us.

We have multiple instances and a deploment process, that uses generating modles in the modulebuilder. To make fields halfway in modulbuilder and in code… might work but will be a mess.
So if there is any way (nomather how ugly) I would try it.

Hi @jasmin

the only thing that comes in my mind is duplicating your fields in your custom module and using a logic hook to trigger on OnSave. However, this also requires code may easily lead to data ambiguity.

I would reconsider creating the field with vardefs and then establishing an intermediate step when you deploy changes made in module builder by

Option 1:

  • Publish your module from module builder
  • Create a script that enhances your module with the required vardef file by performing the following operations:
    • unzip the published module
    • add the required vardef file and language file to the module
    • adapt the manifest.php to make it install the vardef file and language file by adding entries to
  'vardefs' => 
  array ( 
    array (
      'from' => '<basepath>/Extension/Accounts/Vardefs/myextraccountfield.php',
      'to_module' => 'Accounts',
    ),
'language' =>
array (
  array (
    'from' => '<basepath>/Extension/Accounts/en_us.lang.php',
    'to_module' => 'Accounts',
    'language' => 'en_us',
  ),
  • zip your module again
  • Install your module through Admin/Module Loader

Option 2:
Create a separate module just with the vardef file and language file and make sure to always install this module before installing the one that comes from module builder.

Please note that your SuiteCRM version is vulnerable and consider upgrading: