Dear mminnie,
I had to replace text field âinterested_câ with âeng_sum_câ which is decimal type and would store numeric values.
I now need to create a logic hook which if possibly, could use both pieces of information as conditions on each occurance of:
if Activity Type = " link" (Click-thru Link) (link) and other ârelatedâ = (or tracker_id),
then the incremental value is added to custom field âeng_sum_câ.
Only things I could figure out is by now are:
This âCampaignâ Subpanel is getting most data from module: CampaignLog (which has a relationship with Campaign). [Corresponding MySQL Table: campaign_log]
These variables are defined in vardefs.php of suitecrm>modules>CampaignLog> Vardefs of the fields concerned here
There is no directly relationship of any kind between âCampaignlogâ and âLeadsâ. However, CampaingLog does have a relationship with Campaign module.
My current status is that I am not able to make sense of anything of all these scattered pieces of information.
My logic_hook.php is
logic_hook.php
<?php
$hook_version = 1;
$hook_array = Array();
// position, file, function
$hook_array['after_relationship_add'] = Array();
$hook_array['after_relationship_add'][] = Array(1, 'Engagement Scoring via CampaignLogs', 'custom/modules/CampaignLogs/ENGScoring.php', 'SUM', 'ENGScore');
?>
My ENGScoring.php is not making sense to me even.
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class SUM
{
function ENGScore($bean, $event, $arguments)
{
if ($arguments['related_module'] =='Campaign')
{
$leadsBean = BeanFactory::getBean('CampaignLog', $arguments['target_id']);
if ($bean->activity_type == "link")
// && $campaignBean->refer_url == "https://github.com/salesagility/SuiteCRM/pull/2454/commits/1a09fd2cffde60533c0fd03d1f33cfcc8e1e7105")
{
$lead_Bean->eng_sum_c = '55';
$lead_Bean->save();
}
}
}
Please help in building this logic hook definition and underlying logic.
With thanks,
RK