I'm trying to validate imported members. I'm using FieldProviders to check columns values - set fieldProviderOptions.Break to true and throw an exception with detailed message. It works, I'm getting a list of fields errors, but members are still registered. Tried to validate records on RecordImporting, but there's impossible to generate errors list.
So my questions:
How can I prevent members with invalid fields from registering?
Is it possible to validate fields depending on other fields(FieldProviders.Parse receives only one value)?
Am I doing it right or there is another way to validate imported records?
Members are created before assigning values indeed. In case you want full control over data, it's best to write a DataProvider then you have full control over the data CMSImport will use for the import.
Thank you for quick reply. Created a workaround for now: on RecordImporting event got needed data about currently imported record from RecordImportingEventArgs and stored it to request cache. So I have all needed data during validation and other events. Failed records are stored in request cache and related members are deleted on Imported event.
CMSImport PRO 3.5 validating members
Hi.
I'm trying to validate imported members. I'm using FieldProviders to check columns values - set fieldProviderOptions.Break to true and throw an exception with detailed message. It works, I'm getting a list of fields errors, but members are still registered. Tried to validate records on RecordImporting, but there's impossible to generate errors list.
So my questions:
Thanks!
Hi Serge,
Members are created before assigning values indeed. In case you want full control over data, it's best to write a DataProvider then you have full control over the data CMSImport will use for the import.
Hope this helps,
Richard
Hi Richard,
Thank you for quick reply. Created a workaround for now: on RecordImporting event got needed data about currently imported record from RecordImportingEventArgs and stored it to request cache. So I have all needed data during validation and other events. Failed records are stored in request cache and related members are deleted on Imported event.
Thanks for your help,
Sergey.
is working on a reply...