How to disable/enable all validation rules for data loading While working on a recruiting application, I found a solution for being able to load data into a SalesForce application without being blocked by validation rules. Validation rules are usually intended to be applied only when a user creates a record and not when data is being imported from an external database. In this recruiting application, candidate records go several stages in a sequence (1-lead, 2-phone, 3-applicant, 4-interview, 5-contract negotiation, etc.) and this validation rule prevented the import process from loading candidate records in a stage higher than lead. So the solution was to create a Custom Setting of type Hierarchy with a flag/checkbox in it that disables validation rules for a given user or profile. That is, all the validation rules will include this flag and only apply when the value of this flag is enabled. To implement it: 1) click Setup, then on the left side, click App Setup/Dev...
Benefits of batch apex The execution logic of the batch class is called once for each batch of records. The default batch size is 200 records. You can also specify a custom batch size. Furthermore, each batch execution is considered a discrete transaction. With each new batch of records, a new set of governor limits is in effect. In this way, it’s easier to ensure that your code stays within the governor execution limits. Another benefit of discrete batch transactions is to allow for partial processing of a batch of records in case one batch fails to process successfully, all other batch transactions aren’t affected and aren’t rolled back if they were processed successfully. This is a use case that we all come across very often, Schedule a batch class every hour to clean up data or to send out batch emails to case team members (Which I’ll blog about later). There are three main steps involved in this 1. Write a Batch class with the ...
Comments
Post a Comment