AnsweredAssumed Answered

Sugar 7.5 Case's team re-assignment : how do i change team in related email and note ?

Question asked by Gaelle Fernandez on Jun 29, 2016
Latest reply on Jul 21, 2016 by Gaelle Fernandez

Hello there !

It's me again, with a quite strange and mind breaker problem.


What I would like Sugar to do :

I have set the Inbound Emails to generate Cases from a lot of email groups. Generally, theses cases are split between 2 Teams assignment (let's say Team A and Team B)

But, sometimes, the original email has been sent by mistake to the wrong Checkbox, and the user has to re-assign the Case to the other team. So Case01 is assigned from Team A to Team B.

The normal behavior should have been the following : The attached email (the original one) and all the attachments should be re-assigned to team B when a Case is re-assigned from Team A to Team B.


The problem :

Sugar did not developp any of these and the support told me it would be an idea. (see Case #250492 on support portal, if you can)


What i tried :

1) Setting a workflow

Firstly, I tried to set a Workflow. This workflow is launched whenever an existing record is saved. When Team(ID) is modified, the actions are : Updating a field in related module Email : Set Team(ID) to "Current Team of the triggered record".

This totally fails.

2) Writing a after_save Logic hook :

I've tried to create an after_save logic hook under Cases module where i test the $bean->fetched_row['team_id'] to say if it has changed or not. If yes, i would like to take every email related and modify their team assignment. And i would like to get every attachment related to every email and changed their tema assignment too.

I wanted to test the $bean->fetched_row['team_id'], but it seems that first, my code traces into sugarcrm.log does not work, but plus : the tema_id does not change !!! Or i'm calling the bad $bean->fetched_row ?

Please help me. Here is my code :


in custom/Extension/modules/Cases/Ext/LogicHooks/logichooks.php


In custom/modules/Cases/reassignmentRelated.php

fatal('Cases team reassignment: id team  before = '.$bean->fetched_row['team_id'].' AND team assignment now = '.$bean->team_id);                $bean->field_text_c = $bean->fetched_row['team_id']." TEST apres ".$bean->team_id;             }         }     } ?>


Please help me, i'm sure i am wrong someway with the $bean->fetched_row... or maybe you could help me with the workflow ?


Thanks a lot !