Bao Tran Hoang

Modify case number

Discussion created by Bao Tran Hoang on Feb 12, 2017
Latest reply on Feb 12, 2017 by Hemant Patil

I created after_save logic hooks to modify the case_number, But after save case number dose not update, please help me

 

<?php

class CaseNumber
{
public function CreateCaseNumber(SugarBean $bean, $event, $args)
{
global $sugar_config, $db,$current_user;
//process custom field
$bean->retrieve();
$case_number = $bean->case_number;
$current_year = date('Y');
$case_number_new = $current_year . $case_number;
$bean->case_number = $case_number_new;
$bean->save();
}
}

 

Thanks

Outcomes