Hello i use suite crm 7.1
I created a custom datetime field in Meeting called data_c
I created the same field in Lead (relate) called data_c
When I compile the meeting by data_c field, leads the field does not compile,
please can you help?
thanks
Hello i use suite crm 7.1
I created a custom datetime field in Meeting called data_c
I created the same field in Lead (relate) called data_c
When I compile the meeting by data_c field, leads the field does not compile,
please can you help?
thanks
Hi @prmarketing,
2 things for you;
I really would recommend updating to a newer version of SuiteCRM
What your doing to relate the fields I beleave is wrong. @pgr please make sure I’m not being daft here. You have to go to the relate page within that module in studio and create a one to one relationship. Afterwords going to the views you can drag the relate field into the edit or detail view.
Hi @prmarketing
What do you mean by does not compile? could add a log or something similar?
Also how did you create the field? through studio? or manually?
Could you add here a snippet of the vardefs file with the field definition?
Look, I tried everything, read everything on the forum
I have to create field A (in meetings)
field A must be visible in Leads (with the same value)
I tried using Relationships but it doesn’t work
knowing little English and finding few topics for me is not easy
I understand I have to start by building a Relationships and then the fields, now I try then write to you
thanks
Hi again @prmarketing
From the previous version of your post I noticed that you added the fields to vardefs and language files, have you added it also to one of the views?
detailviewdefs.php for example?
Sorry for so many questions, just trying to help, but need a bit more context
I have to create a common field in leads - meetings
Studio - Leads - Relationships
Create Relationships 1 one 1 leads - meetings
result: leads_meetings_1
in custom/Extension/modules/Leads/Ext/Vardefs/data_richiamo.php
<?php
$dictionary['Leads']['fields']['data_richiamo'] = array (
'name' => 'data_richiamo',
'vname' => 'LBL_DATA_RICHIAMO',
'type' => 'datetime',
'dbType' => 'varchar',
'len' => 100,
'audited'=>true,
'unified_search' => true,
'merge_filter' => 'enabled',
'reportable' => '1',
'importable' => 'true',
);
3 ) in custom/Extension/modules/Leads/Ext/Language/en_us.data_richiamo.php
<?php
$mod_strings['LBL_DATA_RICHIAMO'] = 'Data Richiamo';
<?php
$dictionary['Meetings']['fields']['leads_meetings_1_name']['join_link_name'] = 'leads_meetings_link';
$dictionary['Meetings']['fields']['data_richiamo'] = array (
'name' => 'data_richiamo',
'rname' => 'data_richiamo',
'id_name' => 'leads_meetings_1leads_ida',
'vname' => 'LBL_DATA_RICHIAMO',
'join_name'=>'leads',
'join_link_name'=>'leads_meetings_link',
'type' => 'relate',
'link' => 'leads_meetings_1',
'table' => 'leads',
'isnull' => 'true',
'module' => 'Leads',
'dbType' => 'varchar',
'len' => '255',
'source' => 'non-db',
'unified_search' => true,
'massupdate' => false,
'studio' => array('detailview' => 'true'),
);
<?php
$mod_strings['LBL_DATA_RICHIAMO'] = 'Data Richiamo';
strange, after creating the 1 one 1 relationship,
in the studio meeting I see the field leads_meetings_1
but I don’t see the same field in the studio meeting
I managed to create the same field in lead and meeting, but the fields are not copied
tips ?
but is it so hard to work with crm suite?
I just have to copy the event start date to listview lead
I’ve been working on it for 10 days
thanks
I thought I had solved copying the field this way
<?php
$dictionary[‘Lead’][‘fields’][‘date_start’] = array (
‘name’ => ‘date_start’,
‘vname’ => ‘LBL_DATE’,
‘type’ => ‘datetimecombo’,
‘dbType’ => ‘varchar’,
‘len’ => 100,
‘audited’=>true,
‘unified_search’ => true,
‘merge_filter’ => ‘enabled’,
‘reportable’ => ‘1’,
‘importable’ => ‘true’,
);
but the date start meeting field and the new date start lead field are not copied
About copy field.
One way. You can use “logic hook” after_save. There is information here https://docs.suitecrm.com/developer/logic-hooks/
You should write the short custom php code and this code will copy from field “date_start” of Meeting to field “date_start” of “Lead”. These modules should have reationship.
Perhaps my mistake is in creating the relationships between modules?
I enter the studio - modules
New realationship
Module events one to one - module lead
this is my procedure
I tried this solution with a personal field, but it didn’t work
try again,
Ralationship one 1 one work ?
hook logico" after_save (not work)
<?php
// Do not store anything in this file that is not part of the array or the hook version. This file will
// be automatically rebuilt in the future.
$hook_version = 1;
$hook_array = Array();
// position, file, function
$hook_array['before_save'] = Array();
$hook_array['before_save'][] = Array(1, 'Value from one field to another', 'custom/modules/leads/my.php', 'User_hook','copy');
?>
my.php
class User_hook {
function copy(&$bean, $event, $arguments)
{
$bean->date_start = $bean->myfield_c;
}
}
(@prmarketing if you click the “pencil” icon on your post above, you can see my edit and learn how to enter
php
code with syntax highlighting)
After entering the edit, click the Raw button to see how it is done)
You code copy data from field “myfield_c” to field “date_start” of module Lead. You don’t do request to module Meeting. My code for you:
<?php
...
function copy(&$bean, $event, $arguments) {
$meeting_bean = new Meeting();
$meeting_bean->retrieve($bean-><field id of relationship with Meeting>);
$bean->date_start = $meeting_bean->date_start;
}
sorry,
so I have to create hooks
<?php
// Do not store anything in this file that is not part of the array or the hook version. This file will
// be automatically rebuilt in the future.
$hook_version = 1;
$hook_array = Array();
// position, file, function
$hook_array[‘after_save’] = Array();
$hook_array[‘after_save’][] = Array(1, ‘Value from one field to another’, ‘custom/modules/leads/my.php’, ‘User_hook’,‘copy’);
?>
and my.php
<?php
…
function copy(&$bean, $event, $arguments) {
$meeting_bean = new Meeting();
$meeting_bean->retrieve($bean->);
$bean->date_start = $meeting_bean->date_start;
}
Blockquote
$bean->date_start = $meeting_bean->date_start;
or
$bean->my_field = $meeting_bean->date_start;
I wrote about hook after_save if you make:
If you want:
What is your option?
Clean crm suite installation
latest SuiteCRM-7.11.10 version
START !!
in ftp duplicate field date_start
FTP
custom / module / Leads
I create the logic_hooks.php file
<?php
// Do not store anything in this file that is not part of the array or the hook version. This file will
// be automatically rebuilt in the future.
$hook_version = 1;
$hook_array = Array();
// position, file, function
$hook_array[‘after_save’] = Array();
$hook_array[‘after_save’][] = Array(1, ‘Value from one field to another’, ‘custom/modules/Leads/Leads_Hooks.php’, ‘Leads_Hooks’,‘copyField’);
?>
Blockquote
custom/module/Leads
creo il file Leads_Hooks.php
function copy(&$bean, $event, $arguments) {
$meeting_bean = new Meeting();
$meeting_bean->retrieve($bean->);
$bean->date_start= $meeting_bean->date_start;
}
Blockquote
If you want to write to field “date_start” of Lead object from field “date_start” of Meeting object, you sholud control changing in Meeting module using hook after_save.
Here is the code:
custom/modules/logic_hooks.php
$hook_version = 1;
$hook_array = Array();
$hook_array['after_save'] = Array();
$hook_array['after_save'][] = Array(1, '', 'custom/modules/Meetings/my.php', 'User_hook','copy');
custom/modules/Meetings/my.php
class User_hook {
function copy(&$bean, $event, $arguments) {
$lead_bean = new Lead();
$lead_bean->retrieve($bean-><field id of relationship with Lead>);
$lead_bean->date_start = $bean->date_start;
}
}
Change “field id of relationship with Lead” to correct field name. I see name “leads_meetings_1leads_ida” in this conversation.
Thanks, you really have a lot of patience!
Does not work !
I try to explain myself with images, let’s see if I can help you
Thank you so much
using your codes, when I create a lead, it gives me a blank page