Hi,
For example:
In Account module, I have two fields called “Customer Name”, and “Customer Code”, and I also have these two fields in Project module.
If I selected a Customer in Project, is it possible to auto fill its “Customer Code”?
In Account module
Is it possible to auto fill Test Account’s Customer Code after Test Account is selected?
Thank you very much
Yes you can. There are two options to do it.
First, we have workflow. Documentation here:
Second, if you are a programmer, you can use logic hooks. Check documentation here: https://docs.suitecrm.com/developer/logic-hooks/
Thanks,
BrozTechnologies
@Airbus
You can do it without logichook. Look at example here: Auto Populate related fields
Thanks, it works!
But I was wondering what this line is
‘id’ => ‘<your_field_id_of_relate>’,
I skipped this line, and it’s still working.
Thanks
@Airbus
It is the example. You should change ‘<your_field_id_of_relate>’ to your real field name.
Addition:
- Left field is field name from popup module.
- Right field is field name from current module.
- all relate/link fields use 2 fields type - ‘name’ and ‘id’.
Thank you for your quick reply,
I know it is an example, but I was wondering what “id” is. I know “name” is the name of the field, but I am not sure what “id” is. How do I find this “id”.
I skipped the id line, and the auto-fill is working fine.
Thank you very much
@Airbus
There is next combination for this screenshot (Opportunity record). Get “Campaign” for “Account”:
'displayParams' => array (
'field_to_name_array'=> array(
'name' => 'account_name',
'id' => 'account_id',
'campaign_name' => 'campaign_name',
'campaign_id' => 'campaign_id',
),
),
1 Like
**Update: **
I just found the id from the page source, and now the auto populate is working.
Hi, I got “No match for field” error.
I didn’t write this line to editviewdef.php. Is it the reason that gives me the error?
'id' => '???',
If so, how to I find the id field?
Thanks
@Airbus
You should must to use combination (for you “Customer Name”):
'name' => 'account_name',
'id' => 'account_id',
and next combination is optional (for you “Customer Code”):
'campaign_name' => 'campaign_name',
'campaign_id' => 'campaign_id',
I don’t know naming of your fields. Studio make different names for type Relate and Link.
You can look at files:
- cache/modules/Customers/Customersvardefs.php
- cache/Relationships/relationships.cache.php