I'm a little stumped on this. I have a debtor maintenance plugin with the following:
- Code: Select all
public void Setup(IJiwaForm jiwaForm, Plugin plugin)
{
if (!(jiwaForm is frmDebtor)) return;
_debtorForm = (frmDebtor)jiwaForm;
}
private string GetCustomValue(string key)
{
var customField = _debtorForm.Debtor.CustomFieldValues.get_ItemFromSettingName(key);
return customField == null ? "" : customField.Contents;
}
private void SetCustomValue(string key, string value)
{
var customField = _debtorForm.Debtor.CustomFieldValues.get_ItemFromSettingName(key);
if (customField != null) customField.Contents = value;
}
Which all works a treat!
I have ported this to a cashbook plugin as follows:
- Code: Select all
public void Setup(IJiwaForm jiwaForm, Plugin plugin)
{
if (!(jiwaForm is frmCashBook)) return;
_cashBookForm = (frmCashBook)jiwaForm;
}
private string GetCustomValue(string key)
{
var customField = _cashBookForm.CashBook.CustomFieldValues.get_ItemFromSettingName(key);
return customField == null ? "" : customField.Contents;
}
private void SetCustomValue(string key, string value)
{
var customField = _cashBookForm.CashBook.CustomFieldValues.get_ItemFromSettingName(key);
if (customField != null) customField.Contents = value;
}
And it won't play ball! I cannot set a custom value. I have:
- confirmed that the custom fields are created in the plugin
confirmed that the code is executing, including logging that "customField.Contents = value;" is firing
confirmed that nothing is appearing in the database (CB_CustomSettingValues)
Can you point me in the right direction on this?
Cheers,
Neil.



