AnsweredAssumed Answered

Field link with another field under the same module ("Cases" Module)

Question asked by Hazel Hazel on Jan 10, 2015
Latest reply on Jan 12, 2015 by Hazel Hazel
I am using SugarCRM CE 6.5.6. I would like to link the fields up such as when I choose "General Enquiries" as my Type and my subject box will appear as "RE: General Enquiries". 



The "name" and "display label" for my fields are:
name (name) = subject (display label)
issue_c (name) = Issue Regarding (display label)

I tried using Logic hook, whatever I does not work. Here are my codes, 

For logic_hooks.php

<?php
$hook_version = 1; 
$hook_array = Array(); 

// position, file, funtion

$hook_array['after_save'] = Array();
$hook_array['after_save'][] = Array(1, 'Cases push feed', 'modules/Cases/SugarFeeds/CaseFeed.php','CaseFeed', 'pushFeed'); 
$hook_array['after_save'][] = Array(2,'set_case_subject','custom/modules/Cases/set_case_subject.php','set_case_subject','set_case_subject',);
?>


For newly created php file set_case_subject.php

<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

class set_case_subject {

function set_case_subject($bean, $event, $arguments)
{
$issue_c = $bean->issue_c;
$name = $bean->name;

$bean->issue_c = "RE ".$bean->name;

//save record even thought in edit
$bean->save(); 
}
}
?>

Outcomes