[Resolved] Activate cases assignation notification while making assignation by worflow and / or business rules

We have made development to assign the ticket to the user corresponding to categories of the ticket.

But the problem is that the new assigned user is not notify of this assignation.

We have check the email notification on assignation in the administration, It work while assigned manually from the web interface.

Do you know this problem and do you if the a way to avoid this problem, even if it's not upgrade safe ?

Best Regards,

Jérémy

  • The problem is on the PMSE. It not support mail notification on assigned changed. So i have found the way to do it :

    When assigned made by a business rule, you need to add this code (for at least 7.7.1.2 and 7.8.0.0), in the file :

    modules/pmse_Inbox/engine/PMSEElements/PMSEBusinessRule.php

    The code :

    //if data was changed inside the BR, we need to update the Bean
    $historyData = $this->retrieveHistoryData($sugarModule);
    if (is_array($newAppData) && count($newAppData) > 0) {
    foreach ($newAppData as $key => $value) {
    // if the $key attribute doesn't exists it's not saved.
    // so it's not necessarily validate the attribute existence.
    //if (isset($bean->{$key})) {
    // HERE IS THE CODE TO ADD
    if ($key == 'assigned_user_id') {
    if ($value != $bean->assigned_user_id) {
    $bean->notify_inworkflow = true;
    }
    }
    // END OF CODE ADDED
    $historyData->savePredata($key, $bean->{$key});
    $bean->{$key} = $value;
    $historyData->savePostData($key, $value);
    //}
    }
    PMSEEngineUtils::saveAssociatedBean($bean);
    }

    If you use "Assign User" Action in the worflow Manager modifiy like this the file :

    modules/pmse_Inbox/engine/PMSEElements/PMSEAssignUser.php

    With the code :

    if (isset($bean->field_name_map['assigned_user_id']) && (isset($userData->id) && $userData->id == $act_assign_user)) {
    $this->logger->debug("Assign user to '$act_assign_user'");

    $historyData = $this->retrieveHistoryData($flowData['cas_sugar_module']);
    $historyData->savePreData('assigned_user_id', $flowData['cas_user_id']);

    if (isset($bpmnElement['act_update_record_owner']) && $bpmnElement['act_update_record_owner'] == 1) {

    // HERE IS THE CODE TO ADD
    if ($act_assign_user != $bean->assigned_user_id) {
    $bean->notify_inworkflow = true;
    }

    // END OF ADDED CODE
    $bean->assigned_user_id = $act_assign_user;
    if (isset($bean->teams)) {
    $bean->teams->setSaved(false);
    }
    PMSEEngineUtils::saveAssociatedBean($bean);
    }
    $flowData['cas_user_id'] = $act_assign_user;
    $historyData->savePostData('assigned_user_id', $act_assign_user);

    $params = array();
    $params['cas_id'] = $flowData['cas_id'];
    $params['cas_index'] = $flowData['cas_index'];
    $params['act_id'] = $bpmnElement['id'];
    $params['pro_id'] = $bpmnElement['pro_id'];
    $params['user_id'] = $this->currentUser->id;
    $params['frm_action'] = translate('LBL_PMSE_ASSIGN_USER', 'pmse_Inbox');
    $params['frm_comment'] = translate('LBL_PMSE_ASSIGN_USER_APPLIED', 'pmse_Inbox');
    $params['log_data'] = $historyData->getLog();
    $this->caseFlowHandler->saveFormAction($params);
    }