New answers tagged

1

The following point should be noted from the documentation (my emphasis): Each execution of a batch Apex job is considered a discrete transaction. For example, a batch Apex job that contains 1,000 records and is executed without the optional scope parameter from Database.executeBatch is considered five transactions of 200 records each. The Apex governor ...


2

Well, you're getting an approximation of a person's age by only focusing on the year. If a Contact's birthday would be on December 31st, though, you'd get a result saying that they are one year older than they truly are. Maybe that's acceptable in your situation, but if it's not you'll need to add checks against the month and day as well (leading to you ...


0

Parent and child records are not affected by a DML statement on the base object. If you really wanted to do this, you'd have to delete the contacts separately: public void execute(Database.BatchableContext bc, List<Account> scope){ Contact[] contacts = new Contact[0]; for(Account record: scope) { contacts.addAll(record.Contacts); } ...


2

Correct. Correct. In addition, you can also pass collections of primitives. Correct. Note that you're limited to just one call, rather than the 50 you'd get in synchronous code. Incorrect. You are allowed to call a (1) Queueable in a future method. You're also allowed to call (1) future method in other asynchronous code. Correct. Note that this isn't ...


0

As you might be running the batch multiple times this is getting appended. Try to avoid updating the records which already has those prefixes as below by adding this extra condition !(a.name.startswith('Mr.')) as below public class UpdateGender implements database.batchable<sobject> { public database.querylocator start(database....


Top 50 recent answers are included