… wait…i no have Change “field id of relationship with Lead” to correct field name. I see name “leads_meetings_1leads_ida” in this conversation.
There are some problems. Step by step.
- 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();
}
} Blockquote
Correct line:
$lead_bean->retrieve($bean->meetings_leads_1meetings_ida);
without: <>
And see comment before.
Please @prmarketing , clear which type of relationship you want to use one-to-one or parent_name.
I don’t understand what you mean, what should I do
i have modify $lead_bean->retrieve($bean->meetings_leads_1meetings_ida);
the lead is blank now
I use studio is simple for me, i have creare date_start field lead whit php
@prmarketing It’s good the comment. Because.
- If you use Studio all field have “_c” in end of field name.
- If you edit files you can use any name.
I made code and tested it for you.
Please, step by step:
- Delete you relationship one-to-one.
- Delete field “date_start” in Lead module.
- Make “date_start” in Lead module using Studio.
- Use the code:
class User_hook {
function copy(&$bean, $event, $arguments) {
if ($bean->parent_type=='Leads'){
$lead_bean = new Lead();
$lead_bean->retrieve($bean->parent_id);
$lead_bean->date_start_c = $bean->date_start;
$lead_bean->save();
}
}
}
you are great
I have no words to define you !!!
Thanks thanks thanks
if it is not difficult, I can ask you one last thing, since you are so kind and prepared
How can I make LBL_DATE_START
event today: red color
expired event: color …
future event: color
OK. I know decision. I write some late and I be ready for you answer tomorrow.
Decision for you @prmarketing :
- Edit file:
custom/Extension/modules/Leads/Ext/Vardefs/_override_sugarfield_date_start_c.php - Add line:
$dictionary['Lead']['fields']['date_start_c']['function']=array('name' => 'dateStart', 'returns' => 'html', 'onListView' => 'true', 'include' => 'custom/modules/Leads/custom_field_html.php');
- Make and edit file:
custom/modules/Leads/custom_field_html.php - Add code:
<?php
function dateStart($focus, $field, $value, $view){
$late="#0E44CC";
$early="#5E9902";
$today="#FF3609";
if($view==="ListView"){
global $timedate;
$delta = $timedate->fromUser($value)->format("Ymd") - $timedate->getNow()->format("Ymd");
if ($delta > 0){
$color=$early;
}else{
if ($delta < 0){
$color=$late;
} else{
$color=$today;
}
}
return "<b style='color:".$color."'>".$value."<b>";
}
}
- Go to Admin->Repair->Quick Repair and Rebuild
- See ListView of Lead
Please remember if you change the field ‘date_start’ of Lead in Studio you lost addition line (point 2). You can add the line again but don’t fogett to make “Quick Repair and Rebuild”.
that great man, keep it up!
@prmarketing Some change for Lead and Meeting.
I recommend to add control because user can choose Lead but don’t choose the record of Lead.
Old line:
if ($bean->parent_type=='Leads'){
New line:
if ($bean->parent_type=='Leads' && !empty($bean->parent_id)){
Hello friends, my personal field is data_richiamare_c
i have added
_override_sugarfield_data_richiamare_c.php
// created: 2019-12-13 19:44:01
$dictionary[‘Lead’][‘fields’][‘data_richiamare_c’][‘inline_edit’]=‘1’;
$dictionary[‘Lead’][‘fields’][‘data_richiamare_c’][‘labelValue’]=‘Data Richiamare’;
$dictionary[‘Lead’][‘fields’][‘data_richiamare_c’][‘function’]=array(‘name’ => ‘DataRichiamare’, ‘returns’ => ‘html’, ‘onListView’ => ‘true’, ‘include’ => ‘custom/modules/Leads/custom_field_html.php’);Blockquote
custom_field_html.php
function DataRichiamare($focus, $field, $value, $view){
$late="#0E44CC";
$early="#5E9902";
$today="#FF3609";
if($view===“ListView”){
global $timedate;
$delta = $timedate->fromUser($value)->format(“Ymd”) - $timedate->getNow()->format(“Ymd”);
if ($delta > 0){
$color=$early;
}else{
if ($delta < 0){
$color=$late;
} else{
$color=$today;
}
}
return “”.$value."";
}
}Blockquote
and have this error
@prmarketing I am sorry.
Please add the check:
Old line:
if($view==="ListView" ){
New line:
if($view==="ListView" && !empty($value)){
workkkkkkk thank, great man !