To set the properties of a subform field based upon the header form you need to make some considerations otherwise it might be quirky.
The boolean field you add to the sales header probably should be set programically rather than allowing the user to toggle the value, otherwise you will need to add additional code to the fields on validate trigger to check any existing fields in the line records meet the requirements of the new value of the field.
This is a change only to the form and therefore other forms that may use these same tables will have to be modified if you want the same requirements.
Add the boolean field to table 42, for the purposes of this example i am calling the Field “Set Fields”.
Next in the subform 46 you need to go to each textbox that you want to chang, and in the properties change the name property (i.e. change to LocationCode);
Create a global function in the subform (i.e "Activate Fields)
In the “Activate Fields” Function enter the following code:
SalesHeader.GET(“Document Type”,“Document No.”);
CurrForm.LocationCode.EDITABLE(NOT SalesHeader.“Set Fields”);
CurrForm.TaxAreaCode.EDITABLE(NOT SalesHeader.“Set Fields”);
Do this for each field you want to include. Note: I assume true value for “Set Fields” means not editable and false means editable. If your value is reveresed then enter CurrForm.LocationCode.EDITABLE(SalesHeader.“Set Fields”);
Add code to the following subform triggers:
Form - OnAfterGetCurrRecord()
CurrForm.ItemPanel.VISIBLE := Type = Type::Item;
Form - OnNewRecord(BelowxRec : Boolean)
Type := xRec.Type;
If you are allowing the user to change the value of “Set Fields” then you will need to add code to the fields on-validate trigger to test that any existing lines do not violate the new field value. Of course if you are allowing the user to change the “Set Fields” you will need to add it to form 42.