On Accounts, there is a subpanel for Opportunities. I wanted to try and Create an Opportunity using the Quick Create, and as I can see the Assigned To: field is showing the current logged in user. I wanted to actually use the current Assigned To of the current Account instead of current logged in. I tried changing some values on root/modules/Opportunities/OpportunitiesQuickCreate.php but it is not changing anything. Is this possible?
-
Do quick repair and rebuild from admin dashboard. (Admin → System → Repair → Quick Repair and Rebuild)
-
Did you try to change code here?
root/custom/modules/Opportunities/OpportunitiesQuickCreate.php
Tried Quick Repair and Rebuild but it is still not working
(My custom directory does not have a OpportunitiesQuickCreate.php that is why I’m changing the actual file
Maybe, you could copy and paste file there and check.
I also tried editing the root/modules/Opportunities/views/view.edit.php, when I tried to show a debug function, it is showing the debug but if I tried changing adding this:
$this->ss->assign(‘ASSIGNED_USER_ID’, ‘sample_ID’);
it is still not showing. (This is also the function I tried on my OpportunitiesQuickCreate.php
I tried adding this function on my OpportunitiesQuickCreate.php
$GLOBALS[‘log’]->fatal(‘test’);
and it is not showing on my debugging, maybe it is not the correct file to touch? I’m confuse as to what file to touch in this scenario
Found a solution, I used jquery instead. I put it before the return $str on the display() function of the file: root/include/EditView/EditView2.php
if($this->returnModule == 'Accounts' && $this->module == 'Opportunities') { $data = BeanFactory::getBean($this->returnModule, $this->returnId); if($data->id) { $user = BeanFactory::getBean('Users', $data->assigned_user_id); $str .= " <script> $(function() { $('input#assigned_user_name').val('{$user->first_name} {$user->last_name}'); $('input#assigned_user_id').val('{$user->id}'); }); </script>"; } }
This will only work on Accounts detail view Opportunities subpanel
It is probably possible to make that upgrade-safe by overriding the display function (or pre_display might be better) just for the view you want to change.
See this for help