I need help with the Sales Order Lines Custom Fields.
The problem is that when I copy a Sales Order that has all the informations (including the Custom Fields from the Sales Order Line), the new Sales Order looks just fine, but when I save it, it loses all the Custom Fields from the Sales Order Line.
Example:
1) Search for a Sales Order that has all the Custom Fields from the Sales Order Line(s) filled.
2) Copy this Sales Order
3) A new Sales Order will appear with all the information filled (so far it is working fine)
4) Save the Sales Order - automatically loses the Custom Fields from the Sales Order Line(s)
Can someone help me on this? I tried to force setting all the Custom Fields values when saving, but it still does not work.
What I tried:
- Code: Select all
Public Sub SalesOrder_SaveStart(sender As Object, e As System.EventArgs)
Dim salesOrder As JiwaSales.SalesOrder.SalesOrder = DirectCast(sender, JiwaSales.SalesOrder.SalesOrder)
Dim salesOrderForm As JiwaSalesUI.SalesOrder.BaseSalesOrderEntryForm = DirectCast(salesOrder.GenericObjectCollection("SalesOrderForm").Object, JiwaSalesUI.SalesOrder.BaseSalesOrderEntryForm)
Dim gridSheet As JiwaFinancials.Jiwa.JiwaApplication.Controls.Sheet = DirectCast(salesOrderForm.grdLines.ActiveSheet, JiwaFinancials.Jiwa.JiwaApplication.Controls.Sheet)
For row As Integer = 0 To gridSheet.Rows.Count - 1
If Not IsNothing(gridSheet.GetValue(row, 0)) Then
For Each line As JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrderLine In salesOrder.SalesOrderLines
If gridSheet.GetValue(row, 0).ToString() = line.RecID Then
For Each customFieldValue As JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomFieldValue In line.CustomFieldValues
Select Case customFieldValue.CustomField.PluginCustomField.Name
Case "PickPack"
line.CustomFieldValues.ItemFromSettingName("PickPack", "Plugin Name").Contents = gridSheet.Cells(row, gridSheet.Columns("Plugin Name.PickPack").Index).Text


