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
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;
}
}
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;
}
// 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;
in lead I write meeting date, I want that date (date_start) to be displayed in my listview
now I try to write you the complete procedure of the code,
do you kindly confirm that it is right?
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
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.
At the beginnig of this conversation you wrote that you had made new relationship one-to-one (see file: custom/Extension/modules/Meetings/Ext/Vardefs/data_richiamo.php). I decided that you had inserted this field into editview/quickedit form and you would use id field “leads_meetings_1leads_ida”. But you use system relationship parent_name (screenshot: Meeting quickedit form).
Please @prmarketing , clear which type of relationship you want to use one-to-one or parent_name.
I had deleted everything, now I have created a new one to one relationship
Is it right to get my result?
I changed the code as follows, but when I create a lead I get a blank page
class User_hook {
function copy(&$bean, $event, $arguments) {
$lead_bean = new Lead();
$lead_bean->retrieve($bean-><meetings_leads_1meetings_ida>);
$lead_bean->date_start = $bean->date_start;
$lead_bean->save();
}