AnsweredAssumed Answered

Lock down all the fields in Quote line time conditionally

Question asked by Vijayakumar S on Apr 3, 2019



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


For that 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")


This code will make all the fields which I have mentioned in the $fields => array() except the 'quantity' field.


Any idea to make all the fields as read only ?