ERP examples of property groups
Part of property groups.
These examples show how the ERP uses property groups for posting rules and for copying between documents.
Finalized orders and their details
SalesOrderBL gives orders and details separate FinalizedOrderLock groups.
DocNumber uses a separate rule so finalization can fill an empty number.
Shared posting locks
IFinancialDoc declares PostedLock.
DocumentPostingBL defines the rule in Company, so it works without Financials.
Invoice logic and JournalBL add properties to it.
This is the pattern described in Extending a group from another feature.
Keep IsPosted outside the group to allow unposting.
Details use separate groups. See ShipmentBL. Other rules may keep fields read-only after unposting.
ERP header synchronization
SalesOrderInvoiceSyncBL uses OrderInvoiceHeaderSync to copy selected Order and Invoice properties.
It validates targets and calls args.CopyTo(target, skipReadOnly: true) to skip read-only fields.
ERP copies handler changes too, so ChangedBy.Direct is not enough.
DocSync tracks each (source, target, property) copy to prevent loops.
Only the first handler sends a notification. A finally block clears tracking.
See Copying for the simple Direct version.