Thanks Stuart.
That helped. I adapted your (final) sample to provide the functionality needed.
Mike, fyi, using Stuart's final sample in SR13 here, the BusinessLogicPlugin section appears not to fire (no "would have been set by this" MessageBox from there).
In case it helps others, here is the code to allow a Custom Field Value to be set algorithmically during the Debtor Import process ...
- Code: Select all
using JiwaFinancials.Jiwa.JiwaDebtors;
using JiwaFinancials.Jiwa.JiwaDebtors.Import;
using JiwaFinancials.Jiwa.JiwaDebtorsUI.Import;
namespace DebtorImportBPayCRN
{
#region "FormPlugin"
public class FormPlugin : System.MarshalByRefObject, JiwaFinancials.Jiwa.JiwaApplication.IJiwaFormPlugin
{
public override object InitializeLifetimeService()
{
// returning null here will prevent the lease manager
// from deleting the Object.
return null;
}
public void SetupBeforeHandlers(JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm JiwaForm, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
{
var form = JiwaForm as MainForm;
if (form == null) return;
Helper.Manager = JiwaForm.Manager;
form.BrowseUltraButton.Click += delegate { SetBpayCrn(form.DebtorImportObject.DestinationProperties); };
}
public void Setup(JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm JiwaForm, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
{
}
public void SetBpayCrn(DestinationPropertyCollection destinationPropertyCollection)
{
destinationPropertyCollection["Debtor.AccountNo"].SetterMethod = delegate (Debtor debtor, string value, string rowData, string[] row, int rowNo, Mapping mapping)
{
debtor.AccountNo = value;
var bpayCrn = debtor.CustomFieldValues.get_ItemFromSettingName("BpayCrn");
if (string.IsNullOrEmpty(bpayCrn.Contents)) bpayCrn.Contents = NextBpayCrn();
};
}
}
#endregion
}
Cheers,
Neil