You can get to the inventory business logic via the custom field value you already have:
- Code: Select all
Dim inventory As JiwaInventory.Inventory = DirectCast(customFieldValue.CustomField.CustomFieldCollection.BusinessLogic, JiwaInventory.Inventory)
Your snippet with the above incorporated into it would be something like this:
- Code: Select all
Sub ChangedCustomField(Sender As Object, e As System.EventArgs)
Dim customFieldValue As JiwaApplication.CustomFields.CustomFieldValue = DirectCast(sender, JiwaApplication.CustomFields.CustomFieldValue)
Dim inventory As JiwaInventory.Inventory = DirectCast(customFieldValue.CustomField.CustomFieldCollection.BusinessLogic, JiwaInventory.Inventory)
If customFieldValue.CustomField.PluginCustomField.Name = "CustomField1" Then
If CustomFieldValue.Contents = 0 Then
inventory.CustomFieldValues.ItemFromSettingName("CustomField2").Contents = ""
End If
If CustomFieldValue.Contents = 1 Then
inventory.CustomFieldValues.ItemFromSettingName("CustomField2").Contents = "Some text"
End If
End If
End Sub
Mike


