AnsweredAssumed Answered

Cannot access case_number in after_save logic hook.  Null value

Question asked by dnolan dnolan on Sep 29, 2015
Latest reply on Jan 14, 2016 by Francesca Shiekh
I have an after_save logic hook that send's an email upon case creation.

The $bean param from this function shows a 'null' case_number value, so I figured I would just grab the id and make another call to retrieve the case bean which you can see below.

However, this STILL results in a null value for the case_number, whilst all the other fields show the correct value.  

The case number is clearly there in my cases module, so how is it showing null?  Does case_number not get saved until the after_save hook or something?  Guidance appreciated!

function after_case_creation($bean, $event, $arguments) {
    $module = $bean->module_dir;
    $caseId = $bean->id;

    $caseBean = BeanFactory::retrieveBean($module, $caseId);

    $caseNumber = $caseBean->case_number;
    $caseTitle = $caseBean->name;
    $caseContent = $caseBean->description;
    $caseOwnerId = $caseBean->assigned_user_id;