hi there.
i need a logic hook to create a case evertime a new call is created. it does not need to be related, all i want is that the case subject be the same as the call subject, and for me to add a description in the case description.
regards
Paul
hi there.
i need a logic hook to create a case evertime a new call is created. it does not need to be related, all i want is that the case subject be the same as the call subject, and for me to add a description in the case description.
regards
Paul
If you want to create a case everytime a call is created, you have to make a logic hook to Calls.
create custom/modules/Calls/logic_hooks.php with the following content:
then, create custom/modules/Calls/CallsLogicHooks.php :PHP Code:$hook_version = 1;
$hook_array = Array();
$hook_array['after_save'] = Array();
$hook_array['after_save'][] = Array(1, 'create_case', 'custom/modules/Calls/CallsLogicHooks.php', 'CallsLogicHooks', 'create_case',);
/* you shoud judge what is more apropriated: before_save or after_save */
here is a little description fo the logic hooks' structure:PHP Code:if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class CallsLogicHooks {
function create_case(&$focus, $event, $arguments){
// code to create a new case
// $focus is a Call object, containg the info of the saved call
}
}
hope it helpsPHP Code:// LOGIC HOOK QUICK GUIDE:
$hook_array['before_save'][] = Array(2,
'logic_hook_name', // MUST BE UNIQUE. hint: use the function name
'custom/modules/ModuleName/ModuleNameLogicHook.php', // file that has the logic hook codes
'ModuleNameLogicHook', // class name. the class written in the file above
'function_name', // function called by the logic hook. This function must be a method from the class above
);
Daniel de Carvalho Passarini
"Fascinating" - Dr. Spock
This logic hook will create a case every time the call is saved.
Is there a way to check if the bean is saving a NEW record or saving a OLD record?
thanks
You could modify it to query for the ID value before it is saved. If it is present, abort the process, if not, continue.
Regards,
Angel Magaña
Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
Blog: http://cheleguanaco.blogspot.com.
Twitter: @cheleguanaco.
________
| Projects: |_____________________________________
|
| CandyWrapper (.NET Wrapper for SugarCRM SOAP API). Source now available on GitHub!
| GoldMine to SugarCRM Express Conversion. Latest: 1.0.1.7 (Nov. 3, 2009)
| CRM SkyDialer (Skype Integration). Latest: 1.0.2 (Feb. 17, 2010)
| Round Robin Leads Assignment
| Phone Number Formatter
| CaseTwit (Twitter Integration)
______________________________________________
Hello everyone, I have followed the various guides I've found, but wrong,
please help me! : (
I did:
files: logic_hook.php Stored in: /sugarcrm/custom/modules/relst_Relazioni_Aziendali
files:before_save Stored in: /sugarcrm/custom/include/relst_Relazioni_AziendaliPHP Code:<?php
$hook_version = 1;
$hook_array = Array();
$hook_array['before_save'] = Array();
$hook_array['before_save'][] = Array(1, 'before_save', 'custom/relst_Relazioni_Aziendali/before_save.php','before', 'before');
?>
I built the custom module with module builder, and I do not understand where the latter will attach themselves to my files, and how do I do so that they are called or seen by the system ... thank you so much!PHP Code:
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
mysql_connect("localhost","root","sugarcrm");
mysql_select_db("sugarcrm");
//global $current_user
require_once('data/SugarBean.php');
require_once('modules/relst_Relazioni_Aziendali/relst_Relazioni_Aziendali.php');
require_once('include/utils.php');
class before {
function before (&$bean, $event, $arguments)
{
// as contact you can create any other object of any other module
//die("mi sono rotto i coglioni");
$query = "update jjwg_areas set name = 'CULO' where id = '12'";
mysql_query($query);
}
}
?>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks