function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
csreddy7799csreddy7799 

Skip records through trigger while data import.

Hi I want to skip records base condition in trigger while data import. For ex: Am importing records in to accounts, now i want to skip accounts where city is Mumbai, how can i achieve this thriough trigger?

AmulAmul
You cannot apply filter in DataLoad. Here What you can do just write a validation Rule on City @ Account Object. And whenever this validation will occur your import update/insert will be failed for the record. Here You don't require to have Trigger.
souvik9086souvik9086

You can create a validation rule to achieve this.

 

BillingCity = 'Mumbai'

 

Than display error

csreddy7799csreddy7799

@Souvik I just want to skip those records without failing the import wizard.

souvik9086souvik9086

Then there are two ways for that. 

If you insert through dataloader you can give condition there as 

City != 'Mumbai'

 

OR

 

If the record fails through validation rule then it may be failing for that particular record instead of stopping the whole process. So it will skip that particular record and give error for that. Normally dataloader works like that.