⦠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
Please @prmarketing , some minuts.
@prmarketing How do you configure your suitecrm?
- You use Studio.
- Edit php files.
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 !




