AnsweredAssumed Answered

How to solve 'Conflict error'

Question asked by Luca Bartolini on Jan 26, 2016

When the user swap a team_name in record Case i have to put 'SupervisorCRM' (it's a group user) in assigned_user_id.

But sometime i get the page below.

I am logged in with the second one user in list.

 

 

 

 

My Logic Hook before_save

 

<?php

 

 

if (!defined('sugarEntry') || !sugarEntry)

    die('Not A Valid Entry Point');

 

 

class update_on_case_edit {

 

 

    function update_case($bean, $event, $arguments) {

        global $app_list_strings, $current_user;

 

 

        $dropdown = $app_list_strings[$bean->field_defs['cas_gruppo_competenza_c']['options']];

      

 

        if (!empty($bean->fetched_row['id'])) {

            $prevTeam = $bean->fetched_row['team_id'];

            $newTeam = $bean->team_id;

            $eamBn = BeanFactory::getBean('Teams',$newTeam);

            $teamName = $eamBn->name;

            if ($prevTeam != $newTeam) {

                //assigned_user_id set to SupervisorCRM group user id    && Competence Team set to team selected by user

                $dropdown = array_flip($dropdown);

                $bean->cas_gruppo_competenza_c = $dropdown[$teamName];

                $userBN = BeanFactory::getBean('Users');

                $asd = $userBN->get_full_list("", "users.last_name LIKE '%SupervisorCRM%'", "");

                $SupervisorCRM_ID = $asd[0]->id;

                $bean->assigned_user_id = $SupervisorCRM_ID;

            } else {

 

 

                $bean->assigned_user_id = $current_user->id;

                $userBN = BeanFactory::getBean('Users', $current_user->id);

                $bean->cas_gruppo_competenza_c = $userBN->ute_area_c;

            }

        }

     

    }

 

 

}

 

 

?>

 

How to solve this conflict?

 

 

I am using 7.5.2 pro

Outcomes