by Mike.Sheen » Thu Aug 08, 2024 5:43 pm
The key point is to subscribe to the PropertyChanged event of the sales order and examine the Name of the property being changed - this is how you can react to changes of specific fields.
For example:
- Code: Select all
public void Setup(JiwaFinancials.Jiwa.JiwaApplication.IJiwaBusinessLogic JiwaBusinessLogic, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
{
JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder salesOrder = (JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder)JiwaBusinessLogic;
salesOrder.PropertyChanged += SalesOrder_PropertyChanged;
}
private void SalesOrder_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName == "OrderType")
{
JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder salesOrder = (JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder)sender;
if (salesOrder.PreviousOrderType == JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder.SalesOrderOrderTypes.e_SalesOrderOrderTypeForwardOrder &&
salesOrder.OrderType == JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder.SalesOrderOrderTypes.e_SalesOrderOrderTypeInvoiceOrder)
{
salesOrder.InitiatedDate = salesOrder.Manager.SysDateTime;
}
}
}
Plugin working with 7.2.1 SR20 attached.
- Attachments
-
- Plugin Set SO Initiated Date On Order Type change.xml
- (4.59 KiB) Downloaded 67 times
Mike Sheen
Chief Software Engineer
Jiwa Financials
If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution