AnsweredAssumed Answered

Adding a field to a module via installable module

Question asked by Caim Astraea on Feb 9, 2016
Latest reply on Feb 11, 2016 by Caim Astraea

Hello,

I'm using sugar 7.6.1 ~

Trying to follow info found online ,

 

Add Fields to Existing Layouts in Sugar 7

http://stackoverflow.com/questions/21444143/adding-panels-to-editviewdefs-php-via-manifest-file?lq=1

http://stackoverflow.com/questions/12812297/sugarcrm-installable-changes-in-detailview

 

I'm trying to make a simple test by adding a custom field to the accounts module however not managing to get it to show up.

I have a post_install script in the module that looks like

function post_install()
{
    // Debug point - checking to see if get to post_install script
    echo "Made it to the post_install script.<br />";


    // Use the ParserFactory to edit the view arrays
    // Fetch the existing view into an array called $view_array
    require_once('modules/ModuleBuilder/parsers/ParserFactory.php');
    $view_array = ParserFactory::getParser('detailview','Accounts');
    // Declare the additional content 
    $new_content = array
    (
        0 => array
        (
            0 => array
            (
                'name' => 'testfield_c',
                'label' => 'LBL_TESTFIELD',
                'type' => 'varchar',


            ),
        ),
    );
    // Add the new content to the desired section of the view array
    $view_array->_viewdefs['panels']['LBL_RECORDVIEW_PANEL1'] = $new_content;
    //Save the layout
    $view_array->handleSave(false)
           return;
}

 

and a en_us.lang.php that contains the metadata

<?php

$mod_strings = array ('LBL_RECORDVIEW_PANEL1' => 'Accounts');

 

What else am I missing ? Where should I see this field pop up , normally on the first tab of the record view?

Outcomes