I often need to copy custom fields which may exist in inventory, or debtors into sales order custom fields.
I can set the sales order custom fields OK to data from the entity header e.g debtors email address, but I was hoping there might be a one-liner to read a specific debtor custom field value without having to enumerate the debtor custom fields value collection and storing the contents into a variable.
This is what I have so far:
- Code: Select all
Private Sub SalesOrderCreateNewCompleted(sender As Object, e As System.EventArgs)
Dim Debtor As JiwaDebtors.Debtor = JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic(Of JiwaDebtors.Debtor)(Nothing)
Dim SalesOrder As JiwaSales.SalesOrder.SalesOrder = DirectCast(sender, JiwaSales.SalesOrder.SalesOrder)
Debtor.Read(SalesOrder.Debtor.DebtorID)
msgbox(Debtor.AccountNo)
For Each customFieldValue As JiwaApplication.CustomFields.CustomFieldValue In salesOrder.CustomFieldValues
If customFieldValue.CustomField.PluginCustomField.Name = "EMail" Then
customFieldValue.Contents = Debtor.EmailAddress
Exit For
End If
If customFieldValue.CustomField.PluginCustomField.Name = "DBCustField_1"
customFieldValue.Contents = Debtor.CustomFieldValues'something else here
End If
Next
End Sub
Thanks


