Case line items on create view

I'm currently in the proces of doing an upgrade van 7.6 to 7.9.3 and almost all things seem to be working ( with a little bit of development here and there). One of the things that I still cant seem to migrate is the method for adding case line items in the create view of the case module. 

In 7.6 we have added a 'simple' subpanels-create layout to the create-actions view def. At first after upgrading I noticed that only the case line items where showing. I thought this was because of the fact that the create-actions view doesn't exist anymore ( I thought I read it somewhere ) in 7.9.x. 

So I recreated the viewdefs so it uses the create view and the subpanels-create layout. like this: 

 array(         array(             'layout' => array(                 'type' => 'default',                 'name' => 'sidebar',                 'components' => array(                     array(                         'layout' => array(                             'type' => 'base',                             'name' => 'main-pane',                             'css_class' => 'main-pane span8',                             'components' => array(                                 array(                                     'view' => 'create',                                 ),                                 array(                                     'layout' => 'subpanels-create',                                 ),                             ),                         ),                     ),                     array(                         'layout' => array(                             'type' => 'base',                             'name' => 'preview-pane',                             'css_class' => 'preview-pane',                             'components' => array(                                 array(                                     'layout' => 'preview',                                 ),                             ),                         ),                     ),                 ),                 'last_state' => array(                     'id' => 'create-default',                 ),             ),         ),     ), );

Its almost working. For some reason the header of the subpanel create ( which is a case line item subpanel ) does show but no content (edit mode) is shown. 

Someone got a clue on what would cause this behavior?

  • Hi Jeroen Somhorst 

    It means you need to define the subpanel_list_View.

    Take a look at modules/Opportunities/clients/base/layouts/subpanels-create/subpanels-create.php

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Hi Andre,

    I already implemented it like so: 

    <?php
    /*
    * Your installation or use of this SugarCRM file is subject to the applicable
    * terms available at
    * http://support.sugarcrm.com/06_Customer_Center/10_Master_Subscription_Agreements/.
    * If you do not agree to all of the applicable terms or do not have the
    * authority to bind the entity as an authorized representative, then do not
    * install or use this SugarCRM file.
    *
    * Copyright (C) SugarCRM Inc. All rights reserved.
    */

    $viewdefs['Cases']['base']['layout']['subpanels-create'] = array(
        'type' => 'subpanels',
        'components' => array(
            array(
                'layout' => 'subpanel-create',
                'label' => 'LBL_CASESLINEITEMS_SUBPANEL_TITLE',
                'override_subpanel_list_view' => 'subpanel-for-cases-create',
                'context' => array(
                    'link' => 'cli_caselineitems_cases',
                ),
            )
        ),
    );

    When I create a new case I see the following. As you can see I do see the header of the subpanel but the content of the line is not generated ( so I can't add line items)

  • SugarCRM modified the relationship definitions in the version 7.9. Double check it is being properly fetched. Additionally make sure there are no js error at console in the developer tools of your Chrome/Firefox.

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • There are no issues on the developer console of chrome. I don't see any fetching of this at all  I'm currently out of idea's

  • Currently the relationship fields in the custom/metadata/<relationship>MetaData.php must be indexed by theirs own names instead of by numbers.

    Can you kindly share the related scripts you built for Cases subpanels-create under Cases? Additionally share the vardefs/relationship definitions for custom Cases x Cases relationship.

    Cheers

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • The content of the vardef  for caselineitems_cases

    $dictionary["Case"]["fields"]["cli_caselineitems_cases"] = array (
      'name' => 'cli_caselineitems_cases',
      'type' => 'link',
      'relationship' => 'cli_caselineitems_cases',
      'source' => 'non-db',
      'module' => 'cli_CaseLineItems',
      'bean_name' => 'cli_CaseLineItems',
      'vname' => 'LBL_CLI_CASELINEITEMS_CASES_FROM_CASES_TITLE',
      'id_name' => 'cli_caselineitems_casescases_ida',
      'link-type' => 'many',
      'side' => 'left',
    );

    the content of the meta data file for the relationship metadata file:

    <?php
    // created: 2018-02-23 15:08:17
    $dictionary['cli_caselineitems_cases'] = array (
      'true_relationship_type' => 'one-to-many',
      'relationships' =>
      array (
        'cli_caselineitems_cases' =>
        array (
          'lhs_module' => 'Cases',
          'lhs_table' => 'cases',
          'lhs_key' => 'id',
          'rhs_module' => 'cli_CaseLineItems',
          'rhs_table' => 'cli_caselineitems',
          'rhs_key' => 'id',
          'relationship_type' => 'many-to-many',
          'join_table' => 'cli_caselineitems_cases_c',
          'join_key_lhs' => 'cli_caselineitems_casescases_ida',
          'join_key_rhs' => 'cli_caselineitems_casescli_caselineitems_idb',
        ),
      ),
      'table' => 'cli_caselineitems_cases_c',
      'fields' =>
      array (
        'id' =>
        array (
          'name' => 'id',
          'type' => 'varchar',
          'len' => 36,
        ),
        'date_modified' =>
        array (
          'name' => 'date_modified',
          'type' => 'datetime',
        ),
        'deleted' =>
        array (
          'name' => 'deleted',
          'type' => 'bool',
          'len' => '1',
          'default' => '0',
          'required' => true,
        ),
        'cli_caselineitems_casescases_ida' =>
        array (
          'name' => 'cli_caselineitems_casescases_ida',
          'type' => 'varchar',
          'len' => 36,
        ),
        'cli_caselineitems_casescli_caselineitems_idb' =>
        array (
          'name' => 'cli_caselineitems_casescli_caselineitems_idb',
          'type' => 'varchar',
          'len' => 36,
        ),
      ),
      'indices' =>
      array (
        0 =>
        array (
          'name' => 'cli_caselineitems_casesspk',
          'type' => 'primary',
          'fields' =>
          array (
            0 => 'id',
          ),
        ),
        1 =>
        array (
          'name' => 'cli_caselineitems_cases_ida1',
          'type' => 'index',
          'fields' =>
          array (
            0 => 'cli_caselineitems_casescases_ida',
          ),
        ),
        2 =>
        array (
          'name' => 'cli_caselineitems_cases_alt',
          'type' => 'alternate_key',
          'fields' =>
          array (
            0 => 'cli_caselineitems_casescli_caselineitems_idb',
          ),
        ),
      ),
    );
  • I double check the codes your shared and I didn't see anything weird.

    I'll try to replicate it in a fresh install and let you know asap.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Hi André,

    could you point me to the right direction to what I should update to fix this? 

  • Hi Jeroen Somhorst,

    Can you please share the subpanel-case-create file with us? Also, make sure it has a js controller extends from 'SubpanelListCreateView' view. Let us know if that helps.

    Regards.