Can you default the Assigned To of a Case to a blank value?

Upon creating a new case, can the Assigned To be default to a blank value?  The field would be required inducing the user to populate the Assigned To in order to save.  There is a common use case in which the user saving the Case forgets to change the Assigned To which defaults to their own personal user. 

Parents
  • For an upgrade-proof version you first need to create the path: /custom/modules/Cases/

    In that folder create a controller.php that contains this code:

    <?php

    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

    //this file is custom/modules/Cases/controller.php

    require_once('include/MVC/Controller/SugarController.php');

    require_once('custom/modules/Cases/CustomCase.php');

    class CustomCasesController extends SugarController

    {

      public function loadBean()

      {

            $this->bean = new CustomCase();

            if(!empty($this->record))

            {

                $this->bean->retrieve($this->record);

                if($this->bean)

                    $GLOBALS['FOCUS'] = $this->bean;

            }

       }

    }

    Then create the file custom/modules/Cases/CustomCase.php that has this contents:

    <?php

    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

    // this file is /custom/modules/Cases/CustomCase.php

    require ( 'modules/Cases/Case.php' );

    class CustomCase extends Case

    {

    function fill_in_additional_detail_fields()

    {

    parent::fill_in_additional_detail_fields();

    $this->created_by_name = get_assigned_user_name($this->created_by);

    $this->modified_by_name = get_assigned_user_name($this->modified_user_id);

    if(!empty($this->id))

    {

      $account_info = $this->getAccount($this->id);

      if(!empty($account_info)) {

      $this->account_name = $account_info['account_name'];

      $this->account_id = $account_info['account_id'];

    }

    }


    }

    That should do it. You will be upgrade-proof. Just don't forget to Repair just to be safe.

    I have done some similar things, but not this exact customization, so let me know how it works for you.

  • Oops, I see that this won't work since you are calling the parent which would add that value in the field that you want to keep blank. Thus, try adding this line of code right below the parent call

    $this->assigned_user_name = '';

Reply Children
No Data