Is there a way to add other modules to SugarFeeds?
Is there a way to add other modules to SugarFeeds?
In the code, yes.
You can create a logic hook for whatever module that you want. When it's saving the record to the database, you can instantiate the SugarFeed Object (./modules/SugarFeed/SugarFeed.php) and pass in whatever message you want to post about that module in question
You can learn more about logic hooks here:
http://developers.sugarcrm.com/docs/...uide.1.92.html
Sugar University for training
Sugar Wiki for developer and user help
SugarForge for modules, themes, lang packs
SugarExchange for production-ready extensions
Enter/view bugs via the Sugar bug tracker
Hi! thanks for the reply. I found the logic hook for cases and i'll try to do one with projectTasks. If i have any doubts ill post it here!
Last edited by kinshibuya; 2011-01-10 at 06:42 PM.
Hi!
It worked! I added module ProjectTask.
On /sugarcrm/custom/modules/ProjectTask/logic_hooks.php (create this file)
On /sugarcrm/modules/ProjectTask/SugarFeeds/ProjectTaskFeed.php (create this file too)PHP Code:<?php
// Do not store anything in this file that is not part of the array or the hook version. This file will
// be automatically rebuilt in the future.
$hook_version = 1;
$hook_array = Array();
// position, file, function
$hook_array['before_save'] = Array();
$hook_array['before_save'][] = Array(1, 'ProjectTask push feed', 'modules/ProjectTask/SugarFeeds/ProjectTaskFeed.php','ProjectTaskFeed', 'pushFeed');
?>
Then i've repair/rebuild and set the language on /modules/SugarFeed/languagePHP Code:<?php
require_once('modules/SugarFeed/feedLogicBase.php');
require_once('modules/SugarFeed/SugarFeed.php');
class ProjectTaskFeed extends FeedLogicBase{
var $module = 'ProjectTask';
function pushFeed($bean, $event, $arguments){
$text = '';
if(empty($bean->fetched_row)){
$text = '{SugarFeed.CREATED_PROJECTTASK} [' . $bean->module_dir . ':' . $bean->id . ':' . $bean->name . ' ' . $bean->percent_complete . ']';
}else{
if(!empty($bean->fetched_row['percent_complete'] ) && $bean->fetched_row['percent_complete'] != $bean->status && $bean->status != '1'){
$text = '{SugarFeed.ALTERED_PROJECTTASK} [' . $bean->module_dir . ':' . $bean->id . ':' . $bean->name. '] {SugarFeed.FOR_PROJECTTASK} [' . $bean->module_dir . ':' . $bean->id . ':' . $bean->percent_complete . ']';
}
}
if(!empty($text)){
SugarFeed::pushFeed($text, $bean->module_dir, $bean->id
,$bean->assigned_user_id
);
}
}
}
?>
After that i enabled the module on Admin -> Configure Sugar Feeds
Thanks for the help!
Last edited by kinshibuya; 2011-01-10 at 06:43 PM.
Hi,
This is a very useful add-on. I also created different logic_hooks for modules Projects, ProjectTasks, Calls etc.
Only I have a question;
I have set the 'My Feed Dashlet' on my homepage. Now I want all data that is created AND/OR modified by a user (like data in Projects, ProjectTasks, Calls etc.) to show up in my 'My Feed Dashlet' ...?
Now only thing that can be done is to show up data in 'My Feed Dashlet' when I create a Lead, Oppurtunity, Case or Contact. I have added some Feeds and I want these feeds to show all created AND modified data.
See screenshot
How can I do this? Hope someone can help me with this. Thanks in advance
Kind regards,
De Kleine Media
SugarCRM CE v.5.2.0h
Windows platform
MySQL v.5.1
phpMyAdmin - 2.11.2.2
Apache Server v.2.0
Hi,
Can someone tell me if this is possible? If so please let me know how to do it. Thankss
Kind regards,
De Kleine Media
SugarCRM CE v.5.2.0h
Windows platform
MySQL v.5.1
phpMyAdmin - 2.11.2.2
Apache Server v.2.0
Hi! The definitions of when a record is displayed in sugar feeds goes on the file
/modules/Cases/SugarFeeds/CaseFeed.php
The code for every changes would be this one:Code:require_once('modules/SugarFeed/feedLogicBase.php'); require_once('modules/SugarFeed/SugarFeed.php'); class CaseFeed extends FeedLogicBase { var $module = 'Cases'; function pushFeed($bean, $event, $arguments){ $text = ''; if(empty($bean->fetched_row)){ $text = '{SugarFeed.CREATED_CASE} [' . $bean->module_dir . ':' . $bean->id . ':' . $bean->name.'] {SugarFeed.FOR_CASE} [Accounts:' . $bean->account_id . ':' . $bean->account_name . ']<br>'. $bean->description; }else{ if(!empty($bean->fetched_row['status'] ) && $bean->fetched_row['status'] != $bean->status && $bean->status == 'Closed'){ //in my case it will only go to feed if someone changes the status $text = '{SugarFeed.CLOSED_CASE} [' . $bean->module_dir . ':' . $bean->id . ':' . $bean->name. '] {SugarFeed.FOR_CASE} [Accounts:' . $bean->account_id . ':' . $bean->account_name . ']'; } } if(!empty($text)){ SugarFeed::pushFeed($text, $bean->module_dir, $bean->id ,$bean->assigned_user_id ); } } }
In admin sugar feeds you must mark all modules,Code:require_once('modules/SugarFeed/feedLogicBase.php'); require_once('modules/SugarFeed/SugarFeed.php'); class CaseFeed extends FeedLogicBase { var $module = 'Cases'; function pushFeed($bean, $event, $arguments){ $text = ''; if(empty($bean->fetched_row)){ $text = '{SugarFeed.CREATED_CASE} [' . $bean->module_dir . ':' . $bean->id . ':' . $bean->name.'] {SugarFeed.FOR_CASE} [Accounts:' . $bean->account_id . ':' . $bean->account_name . ']<br>'. $bean->description; }else{ // if(!empty($bean->fetched_row['status'] ) && $bean->fetched_row['status'] != $bean->status && $bean->status == 'Closed'){ $text = '{SugarFeed.CLOSED_CASE} [' . $bean->module_dir . ':' . $bean->id . ':' . $bean->name. '] {SugarFeed.FOR_CASE} [Accounts:' . $bean->account_id . ':' . $bean->account_name . ']'; //} } if(!empty($text)){ SugarFeed::pushFeed($text, $bean->module_dir, $bean->id ,$bean->assigned_user_id ); } } }
and you mus edit the my feeds dashlet and choose the option all modules
Priscila Kin Yamamoto Joranhezon
Phone: +55 61 32010000
priscila.joranhezon@nct.com.br
NCT Informática Ltda
I'm having trouble getting this add-on to work for custom modules. Created the following files, rebuilt/repaired, and added in admin settings without error, but now records are not being put into the database when saved. Any ideas as to what I'm doing wrong? Does something different need to be done for Custom modules?
/crm/custom/modules/green_Proposals/logic_hooks.php
/crm/modules/green_Proposals/SugarFeeds/green_ProposalsFeed.phpCode:<?php // Do not store anything in this file that is not part of the array or the hook version. This file will // be automatically rebuilt in the future. $hook_version = 1; $hook_array = Array(); // position, file, function $hook_array['before_save'] = Array(); $hook_array['before_save'][] = Array(1, 'green_Proposals push feed', 'modules/green_Proposals/SugarFeeds/green_ProposalsFeed.php','green_ProposalsFeed', 'pushFeed'); ?>
Code:<?php require_once('modules/SugarFeed/feedLogicBase.php'); require_once('modules/SugarFeed/SugarFeed.php'); class green_ProposalsFeed extends FeedLogicBase{ var $module = 'green_Proposals'; function pushFeed($bean, $event, $arguments){ $text = ''; if(empty($bean->fetched_row)){ $text = '{SugarFeed.CREATED_green_Proposals} [' . $bean->module_dir . ':' . $bean->id . ':' . $bean->name . ' ' . $bean->percent_complete . ']'; }else{ if(!empty($bean->fetched_row['percent_complete'] ) && $bean->fetched_row['percent_complete'] != $bean->status && $bean->status != '1'){ $text = '{SugarFeed.ALTERED_green_Proposals} [' . $bean->module_dir . ':' . $bean->id . ':' . $bean->name. '] {SugarFeed.FOR_green_Proposals} [' . $bean->module_dir . ':' . $bean->id . ':' . $bean->percent_complete . ']'; } } if(!empty($text)){ SugarFeed::pushFeed($text, $bean->module_dir, $bean->id ,$bean->assigned_user_id ); } } } ?>
Last edited by davingreen; 2010-08-04 at 04:16 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks