How to get the field from another module and display it into a different module?

Hi,

I created custom/modules/SR_SR_Notes/views/view.list.php

SR_SR_Notes is custom module and there are relationship(MtoM) between Leads module. My relation name is “sr_sr_notes_leads”. I want to get “Full Name” from Lead module to in my custom module list view which is SR_SR_Notes.

<?php

    require_once('include/MVC/View/views/view.list.php');

    class SR_SR_NotesViewList extends ViewList {

        function SR_SR_NotesViewList() {
            parent::ViewList();
        }

        function display() {

            $notes_link = 'sr_sr_notes_leads';

            if( $this->bean->load_relationship( $notes_link ) ) {

                $organisationBeans = $this->bean->$notes_link->getBeans();
                $organisationBean = reset($organisationBeans);

                $this->ss->assign( 'NAME', $organisationBean->first_name );
            }

            parent::display();
        }
}

This is my listviewdefs.php file;

 'FULL_NAME_C' =>
      array (
        'name' => 'full_name_c',
        'type' => 'varchar',
        'default' => true,
        'label' => 'LBL_FULL_NAME',
        'customCode' => '{$NAME}',
        'width' => '10%',
      ),

Regards,

Don’t know if it helps but I was thinking you can use call the bean you want and search the fields you need on your other module

$bean = BeanFactory::getBean(’’, $beanId);
//For example to retrieve an account id
$bean = BeanFactory::getBean(‘Accounts’, $beanId);

https://docs.suitecrm.com/developer/working-with-beans/

Hi,
Since we upgraded to 7.11.10 this is no longer working. Can someone please help?

Hey Buddy did you get the solution ? even i am also searching for the same functionality If you have the solution please help me also.

Here is what I did to get around.
Create new field in the Accounts.
Copy the other module field to Accounts.
Below is code defined in
/var/www/html/suitecrm/custom/modules/Accounts/views/view.detail.php

function display() {
   $accounts_link = 'crm_sites_accounts_1';
   $crm_sites_Beans = $this->bean->$accounts_link->getBeans();
   $this->bean->site_notes_c = $crm_sites_Bean->site_notes;
   $this->bean->site_project_mgr_c = $crm_sites_Bean->project_mgr;
   $this->bean->save();
}

What this code is doing ? can you please explain it once ? I don’t understand this code can you please help me. I have one field in Task module and when i create Task for any account then i want that field in list view with proper data against that account . Please help
Thank you in advance

namitkakusuitecrm,
create new_field_hold_task_val in Account module.
Define function display below in
/var/www/html/suitecrm/custom/modules/Accounts/views/view.detail.php

function display() {
   $task_rel = ‘account_tasks';  // look up relationship
   $task_Beans = $this->bean->$task_rel->getBeans(); 
   $this->bean->new_field_hold_task_val  = $task_Bean->task_field_val;   //Copy field from task to account.

   $this->bean->save();
}

Hope this help.

Ok let me try this .I will let you know for further help if needed. And another thing is how i will show this field in list view in accounts module ?
How this will work sir if we don’t have any field in Tasks module i have to create field in task module also ?

Sir below is the scenario:
I have one field in Task module “Order Type” when i create any Task for that account from activities then How should i display that “Order Type” field in account module.?

Only this much i had put in view.detail.php under php tag fine ?

Hello Sir
As per your code i had created one field inside Account module and also i had added that field in Edit view now when i create any account then how it should be related to Tasks ?