Hi Riyaz,
I'm not sure if Sbarnes solution suits or not - I interpreted the question a little differently.
The attached plugin demonstrates how to detect when a custom field on the purchase order changes, and how to iterate all lines on the purchase order and set a property of each line (in this example I simply set the description of each line to be the value of the custom field).
The code itself is all in the BusinessLogicPlugin class:
- Code: Select all
public void Setup(JiwaFinancials.Jiwa.JiwaApplication.IJiwaBusinessLogic JiwaBusinessLogic, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
{
JiwaFinancials.Jiwa.JiwaPurchaseOrders.PurchaseOrder purchaseOrder = (JiwaFinancials.Jiwa.JiwaPurchaseOrders.PurchaseOrder)JiwaBusinessLogic;
purchaseOrder.CustomFieldValues.Changed += PurchaseOrder_CustomFieldValue_Changed;
}
public void PurchaseOrder_CustomFieldValue_Changed(JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomFieldValue item, System.ComponentModel.PropertyChangedEventArgs e)
{
if (item.CustomField.PluginCustomField.Name == "TestCustomField")
{
JiwaFinancials.Jiwa.JiwaPurchaseOrders.PurchaseOrder purchaseOrder = (JiwaFinancials.Jiwa.JiwaPurchaseOrders.PurchaseOrder)item.CustomFieldValueCollection.CustomFieldCollection.BusinessLogic;
foreach (JiwaFinancials.Jiwa.JiwaPurchaseOrders.Line poLine in purchaseOrder.Lines)
{
// Demonstrate setting a property of the purchase order line
poLine.Description = item.Contents;
}
}
}
The plugin provided targets 07.01.00 - but if you need it for an earlier version it should work fine as well.