AnsweredAssumed Answered

Set QLI Field Required in Dependencies but not working in Edit View

Question asked by Aravind Kumar on Mar 26, 2019
Latest reply on Mar 28, 2019 by André Lopes

Hi All,

 

I'm trying to make a custom product field in QLI as Required, So I made necessary changes. This particular field "total_number_c" should be a Required in QLI based on the Quote field value Dependencies, So I made the following change:

src/custom/modules/Products/clients/base/views/quote-data-group-list/quote-data-group-list.php

array(
      'name' => 'total_number_c',
      'label' => 'LBL_TOTAL_NUMBER',
),

 src/custom/Extension/modules/Products/Ext/Vardefs/total_number_c.php
<?php
/**
* Total Number - custom db field
*/

$dictionary['Product']['fields']['total_number_c'] = array(
    'audited'                   => true,
    'calculated'                => false,
    'cols'                      => '',
    'comments'                  => 'Total Number',
    'default'                   => '',
    'dependency'                => '',
    'duplicate_merge_dom_value' => '0',
    'duplicate_merge'           => 'disabled',
    'help'                      => '',
    'len'                       => '255',
    'massupdate'                => false,
    'merge_filter'              => 'disabled',
    'name'                      => 'total_number_c',
    'no_default'                => false,
    'reportable'                => true,
    'required'                  => false,
    'rows'                      => '',
    'size'                      => '255',
    'source'                    => 'custom_fields',
    'studio'                    => 'visible',
    'type'                      => 'varchar',
    'unified_search'            => false,
    'vname'                     => 'LBL_TOTAL_NUMBER',
);

Dependencies: 

src/custom/Extension/modules/Products/Ext/Dependencies/magaging_business_rules.php

<?php
$dependencies['Products']['magaging_rules'] = array(
      'hooks' => array("edit", "view"),
      'trigger' => 'true',
      'onload' => true,
      'actions' => array(
                                 array(
                                       'name' => 'SetRequired',
                                       'params' => array(
                                             'target' => 'total_number_c',
                                             'label' => 'LBL_TOTAL_NUMBER',
                                             'value' => 'isInList(related($quotes,"managing_c"), createList("one","two"))',
                                       ),
                                  ),
                                 array(
                                       'name' => 'SetVisibility',
                                       'params' => array(
                                             'target' => 'total_number_c',
                                             'label' => 'LBL_TOTAL_NUMBER',
                                             'value' => 'isInList(related($quotes,"managing_c"), createList("one","two"))',
                                       ),
                                 ),
               ),
);

If you can see the following image the "Total Number" field in QLI is not REQUIRED even "managing_c" value "one".

 

QLI Product Required

Outcomes