AnsweredAssumed Answered

Lock down all the fields in Quote line time conditionally

Question asked by Vijayakumar S on Apr 10, 2019
Latest reply on Apr 10, 2019 by André Lopes



I am trying to make all the fields in Quote Line Item read only when the Quote stage is "Invoiced/Credited"


Quote Line Item is nothing but a Product, so I  have created a file src/custom/modules/Products/metadata/dependencydefs.php


Here my code



$dependencies['Products']['read_only_fields'] = array();
 $fields = array(

$dependencies['Products']['read_only_fields'] = array(
         'hooks' => array("all"),
         'trigger' => 'or(equal(related($quotes,"quote_stage"),"Invoiced"),                                  equal(related($quotes,"quote_stage"),"Credited")

         'onload' => true,
         'actions' => array(),


foreach ($fields as $field) {
         $dependencies['Products']['read_only_fields']['actions'][] = array(
                  'name' => 'ReadOnly', 
                  'params' => array(
                        'target' => $field,
                         'value' => 'or(equal(related($quotes,"quote_stage"),"Invoiced"),                                                                                                       equal(related($quotes,"quote_stage"),"Credited")



While edit the Quote Line Item it will make all the fields as read only except the "quantity" field



See the above image. while edit the QLI I am unable to make the "quantity" field as read only