Email case creation created by default user

We've implemented de inbound email automatic case creation. Following the next tutorial: 

Everything is working fine, however we noticed all cases are created by a specfic user. Our guess its the default user/ the account administrator.

We would like to change this so its created by a user from a team or a different specific user.

Just to be clear we are talkin about the "Created by" field not the "Assignee"

We've tried the next code in the InboundEmail.php in ./costume/modules/InboundEmail/

   $c->created_by = 'My.Username'

That would not work

Any guesses?

  • The idea that you have is correct.



    line in the handleCreateCase function, you can run a query to update the created_by column in the database, based on the $c->id value. This is, assuming that you have already set the setting of the assigned to the user. If you have already done that, then the user you want to assign to the created_by will be passed in the parameter and will be available in the $userId variable.

    Also, the path of your custom file should be




    Kind Regards!
    Rolustech Support

  • So I tried the next:

       $c->created_by = $userId; //This is the only line I added
    $caseId = $c->id;

    Didnt work, maybe I undertood something different than what you proposed?

    Also, thanks for the path check! That was a typo just on this thread, the file is indeed in /custom/ not /costume/

    Me gusta Mostrar 0 me gusta(0)  Comentar  Compartir
  • When you set created by/date and updated by/date in code you need to tell the system not to override them in the save process. You can override some, or all of the following:

       //prevent the save process from overriding created by and modified by users and dates on the case bean ($c)

       $c->update_date_modified = false;
       $c->update_modified_by = false;
       $c->set_created_by = false;
       $c->update_date_entered = false;

    // in your case if you are just overriding the created by then just use

       $c->set_created_by = false;

    //note that the initial save process also sets the modified by so you may want to update that too if different from what the default would be.

    Also, you will want to set the above, and the created by, BEFORE the save, not after.


  • Hi,

    As suggested by Francesca Shiekh, I have added the code like below and it's worked out for me.

    Please add the below two lines of code before the bean save as shown in above ss.

    $c->assigned_user_id = $userId;
    $c->set_created_by = false;