I want to display current loged in user name in Created By box like Assign To in sugar crm

I want to display current loged in user name in Created By box like Assign To in sugar crm

Hi Qazi,

You can do it in following ways.

  1. You can modify view.edit.php file of a particular module if you want solution only for selected module.
  2. For generic solution you can modify - custom/include/MVC/View/views/view.edit.php
    Inside display function after $this->ev->process() method call use this code. Same code for 1 &2

global $current_user;
$this->ev->fieldDefs['created_by_name']['value']=$current_user->name;
$this->ev->fieldDefs['created_by']['value']=$current_user->id;
  1. You can also modify for generic solution - custom/include/EditView/EditView2.php. Go for this solution only if you can not go for 1 and 2.
    Inside display function put this code

global $current_user;
$this->fieldDefs['created_by_name']['value']=$current_user->name;
$this->fieldDefs['created_by']['value']=$current_user->id;

Thanks and Regards,
Alpesh Savaliya.

Thanks for your quick reply Alpesh.
But I dont have custom/include/MVC/View/views/view.edit.php in my working code paket.

Hi,
You can copy past it from - include/MVC/View/views/view.edit.php

Hi Alpesh,

I am geting Current User name, But unable to display in Created By textbox.

Please help any one

Thanks

Hi,
Can you please share your code here ?