Hi Every one,
I am new to business central,
First of all, Is it possible to override the default validation functionality of existing table fields in Business Central?
If yes, then i have a business requirement, i need to change the validation for "Drop Shipment" field in sales order line items (That belongs to "Sales line" table) of sales order page, to true when Item type is of either item or Charge (Item). As the validation for "Drop Shipment" field is set by default for type item, Now i need to validate it to true if the item type selected is Charge Item also.
Here is my table extension that is extending "Sales Line", but i don't know how to by pass the validation for the above scenario.
tableextension 50114 AX_Sales_Line_Ext extends "Sales Line" { fields { modify("Drop Shipment") { trigger OnBeforeValidate() begin // if an item Type is of Charge Item or Item then it should validate to true. if (Type = Type::"Charge (Item)") OR (Type = Type::Item) then begin end; end; trigger OnAfterValidate() begin // if an item Type is of Charge Item or Item then it should validate to true. if (Type = Type::"Charge (Item)") OR (Type = Type::Item) then begin end; end; // trigger Validate() Validate trigger is not present for the pre-installed table fields // begin // end; } } }
Just for reference, When i debug the extension, the debugger reached into the definition of "Drop Shipment" and it throws exception on the validation of TestField(Type,Type::Item) when the item type selected is other than item, which shows as validation error on the UI.
your guidance will be highly appreciated.
As you can see in your screenshot, there is no IsHandled subscription to the validation on the Drop Shipment. So there is no way to modify standard behavior of that field.
My suggestion is to take a look at the business process again and consider if using the Drop Shipment functionality is the right way to do it. Drop Shipment is good but there is a lot of restriction in it (which is understandable in some ways).
If you just want to link between Purchase and Sales, just create a new field and use that field to link Sales and Purchase. And create a new function to create Sales from Purchase. There is no need to use the Drop Shipment functionality.
Thank you divyesh chitte,
As mentioned above it is basically to accommodate the freight and recycling items. As I am new to Business central, would you guide me how to achieve the required functionality. I am not going to change the complete functionality of drop shipment, just need to achieve item charged can also be entered as drop shipment.
Thank you.
Hi TanzeelurRehman,
I well not recommend the change, as Drop Shipment functionality is altogether different functionality which involves Link of Sales and Purchases Documents and Requisition Worksheet.
So if you make any changes in the Drop Shipment Functionality you will definitely be facing issues in the system if you are using Requisition Worksheet.
Still, if this is business requirement you can first analysis the requirement properly and then make changes in the default system
Thank you for your reply @Teddy H
It is basically a business requirement and yes you are right. freight and for recycle we need to change it.
I know drop shipment has a validation for item only, when drop shipment is selected the type must be of item type otherwise it throws validation error, but we need to add item (charge) to be validated to true if drop shipment is selected for item (charge). The validation happens at the field level in Validate trigger.
so can we override the field level validation using IsHandled variable that you have mentioned in your reply. would you share some reference material or code chunk to implement it. I am developing the implementation on local container.
You can't change the standard validation, unless it has a subscription with IsHandled variable.
Why do you want the drop shipment for item charge ? Are you charging freight back to customer ?
Sohail Ahmed
944
YUN ZHU
843
Super User 2025 Season 1
Mansi Soni
602